Skip to content

(MODULES-9432) Remove Style/HashSyntax rubocop rule #1032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ RSpec/NamedSubject:
Enabled: false
Lint/ScriptPermission:
Enabled: false
Style/HashSyntax:
Exclude:
- spec/spec_helper.rb
EnforcedStyle: hash_rockets
Layout/IndentHeredoc:
Enabled: false
2 changes: 1 addition & 1 deletion lib/facter/facter_dot_d.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def cache_save!
def cache_store(file, data)
load_cache

@cache[file] = { :data => data, :stored => Time.now.to_i }
@cache[file] = { data: data, stored: Time.now.to_i }
rescue # rubocop:disable Lint/HandleExceptions
end

Expand Down
4 changes: 2 additions & 2 deletions lib/facter/package_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# Instantiates a dummy package resource and return the provider
setcode do
if defined? Gem && Gem::Version.new(Facter.value(:puppetversion).split(' ')[0]) >= Gem::Version.new('3.6')
Puppet::Type.type(:package).newpackage(:name => 'dummy', :allow_virtual => 'true')[:provider].to_s
Puppet::Type.type(:package).newpackage(name: 'dummy', allow_virtual: 'true')[:provider].to_s
else
Puppet::Type.type(:package).newpackage(:name => 'dummy')[:provider].to_s
Puppet::Type.type(:package).newpackage(name: 'dummy')[:provider].to_s
end
end
end
6 changes: 3 additions & 3 deletions lib/facter/pe_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

# Fact: pe_major_version
Facter.add('pe_major_version') do
confine :is_pe => true
confine is_pe: true
setcode do
pe_version = Facter.value(:pe_version)
if pe_version
Expand All @@ -45,7 +45,7 @@

# Fact: pe_minor_version
Facter.add('pe_minor_version') do
confine :is_pe => true
confine is_pe: true
setcode do
pe_version = Facter.value(:pe_version)
if pe_version
Expand All @@ -56,7 +56,7 @@

# Fact: pe_patch_version
Facter.add('pe_patch_version') do
confine :is_pe => true
confine is_pe: true
setcode do
pe_version = Facter.value(:pe_version)
if pe_version
Expand Down
4 changes: 2 additions & 2 deletions lib/facter/root_home.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def returnt_root_home
end

Facter.add(:root_home) do
confine :kernel => :darwin
confine kernel: :darwin
setcode do
str = Facter::Util::Resolution.exec('dscacheutil -q user -a name root')
hash = {}
Expand All @@ -34,7 +34,7 @@ def returnt_root_home
end

Facter.add(:root_home) do
confine :kernel => :aix
confine kernel: :aix
root_home = nil
setcode do
str = Facter::Util::Resolution.exec('lsuser -c -a home root')
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/service_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@

Facter.add(:service_provider) do
setcode do
Puppet::Type.type(:service).newservice(:name => 'dummy')[:provider].to_s
Puppet::Type.type(:service).newservice(name: 'dummy')[:provider].to_s
end
end
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/abs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# abs.rb
#
module Puppet::Parser::Functions
newfunction(:abs, :type => :rvalue, :doc => <<-DOC
newfunction(:abs, type: :rvalue, doc: <<-DOC
@summary
**Deprected:** Returns the absolute value of a number

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/any2array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# any2array.rb
#
module Puppet::Parser::Functions
newfunction(:any2array, :type => :rvalue, :doc => <<-DOC
newfunction(:any2array, type: :rvalue, doc: <<-DOC
@summary
This converts any object to an array containing that object.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/any2bool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# any2bool.rb
#
module Puppet::Parser::Functions
newfunction(:any2bool, :type => :rvalue, :doc => <<-DOC
newfunction(:any2bool, type: :rvalue, doc: <<-DOC
@summary
Converts 'anything' to a boolean.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/assert_private.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# assert_private.rb
#
module Puppet::Parser::Functions
newfunction(:assert_private, :doc => <<-DOC
newfunction(:assert_private, doc: <<-DOC
@summary
Sets the current class or definition as private.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/base64.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
module Puppet::Parser::Functions
newfunction(:base64, :type => :rvalue, :doc => <<-DOC) do |args|
newfunction(:base64, type: :rvalue, doc: <<-DOC) do |args|
@summary
Base64 encode or decode a string based on the command and the string submitted

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/basename.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# basename.rb
#
module Puppet::Parser::Functions
newfunction(:basename, :type => :rvalue, :doc => <<-DOC
newfunction(:basename, type: :rvalue, doc: <<-DOC
@summary
Strips directory (and optional suffix) from a filename

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/bool2num.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# bool2num.rb
#
module Puppet::Parser::Functions
newfunction(:bool2num, :type => :rvalue, :doc => <<-DOC
newfunction(:bool2num, type: :rvalue, doc: <<-DOC
@summary
Converts a boolean to a number.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/bool2str.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# bool2str.rb
#
module Puppet::Parser::Functions
newfunction(:bool2str, :type => :rvalue, :doc => <<-DOC
newfunction(:bool2str, type: :rvalue, doc: <<-DOC
@summary
Converts a boolean to a string using optionally supplied arguments.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/camelcase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
#
module Puppet::Parser::Functions
newfunction(:camelcase, :type => :rvalue, :doc => <<-DOC
newfunction(:camelcase, type: :rvalue, doc: <<-DOC
@summary
**Deprecated** Converts the case of a string or all strings in an array to camel case.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/capitalize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
#
module Puppet::Parser::Functions
newfunction(:capitalize, :type => :rvalue, :doc => <<-DOC
newfunction(:capitalize, type: :rvalue, doc: <<-DOC
@summary
**Deprecated** Capitalizes the first letter of a string or array of strings.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/ceiling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ceiling.rb
#
module Puppet::Parser::Functions
newfunction(:ceiling, :type => :rvalue, :doc => <<-DOC
newfunction(:ceiling, type: :rvalue, doc: <<-DOC
@summary
**Deprecated** Returns the smallest integer greater or equal to the argument.
Takes a single numeric value as an argument.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/chomp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# chomp.rb
#
module Puppet::Parser::Functions
newfunction(:chomp, :type => :rvalue, :doc => <<-DOC
newfunction(:chomp, type: :rvalue, doc: <<-DOC
@summary
**Deprecated** Removes the record separator from the end of a string or an array of strings.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/chop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# chop.rb
#
module Puppet::Parser::Functions
newfunction(:chop, :type => :rvalue, :doc => <<-DOC
newfunction(:chop, type: :rvalue, doc: <<-DOC
@summary
**Deprecated** Returns a new string with the last character removed.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/clamp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# clamp.rb
#
module Puppet::Parser::Functions
newfunction(:clamp, :type => :rvalue, :arity => -2, :doc => <<-DOC
newfunction(:clamp, type: :rvalue, arity: -2, doc: <<-DOC
@summary
Keeps value within the range [Min, X, Max] by sort based on integer value
(parameter order doesn't matter).
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/concat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# concat.rb
#
module Puppet::Parser::Functions
newfunction(:concat, :type => :rvalue, :doc => <<-DOC
newfunction(:concat, type: :rvalue, doc: <<-DOC
@summary
Appends the contents of multiple arrays into array 1.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/convert_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# convert_base.rb
#
module Puppet::Parser::Functions
newfunction(:convert_base, :type => :rvalue, :arity => 2, :doc => <<-'DOC') do |args|
newfunction(:convert_base, type: :rvalue, arity: 2, doc: <<-'DOC') do |args|
@summary
Converts a given integer or base 10 string representing an integer to a
specified base, as a string.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/count.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# count.rb
#
module Puppet::Parser::Functions
newfunction(:count, :type => :rvalue, :arity => -2, :doc => <<-DOC
newfunction(:count, type: :rvalue, arity: -2, doc: <<-DOC
@summary
Counts the number of elements in array.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/deep_merge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# deep_merge.rb
#
module Puppet::Parser::Functions
newfunction(:deep_merge, :type => :rvalue, :doc => <<-'DOC') do |args|
newfunction(:deep_merge, type: :rvalue, doc: <<-'DOC') do |args|
@summary
Recursively merges two or more hashes together and returns the resulting hash.

Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/parser/functions/defined_with_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
require 'puppet/parser/functions'

Puppet::Parser::Functions.newfunction(:defined_with_params,
:type => :rvalue,
:doc => <<-DOC
type: :rvalue,
doc: <<-DOC
@summary
Takes a resource reference and an optional hash of attributes.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# delete.rb
#
module Puppet::Parser::Functions
newfunction(:delete, :type => :rvalue, :doc => <<-DOC
newfunction(:delete, type: :rvalue, doc: <<-DOC
@summary
Deletes all instances of a given element from an array, substring from a
string, or key from a hash.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/delete_at.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# delete_at.rb
#
module Puppet::Parser::Functions
newfunction(:delete_at, :type => :rvalue, :doc => <<-DOC) do |arguments|
newfunction(:delete_at, type: :rvalue, doc: <<-DOC) do |arguments|
@summary
Deletes a determined indexed value from an array.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/delete_regex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
#
module Puppet::Parser::Functions
newfunction(:delete_regex, :type => :rvalue, :doc => <<-DOC
newfunction(:delete_regex, type: :rvalue, doc: <<-DOC
@summary
Deletes all instances of a given element that match a regular expression
from an array or key from a hash.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/delete_undef_values.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# delete_undef_values.rb
#
module Puppet::Parser::Functions
newfunction(:delete_undef_values, :type => :rvalue, :doc => <<-DOC
newfunction(:delete_undef_values, type: :rvalue, doc: <<-DOC
@summary
Returns a copy of input hash or array with all undefs deleted.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/delete_values.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# delete_values.rb
#
module Puppet::Parser::Functions
newfunction(:delete_values, :type => :rvalue, :doc => <<-DOC
newfunction(:delete_values, type: :rvalue, doc: <<-DOC
@summary
Deletes all instances of a given value from a hash.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/deprecation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# deprecation.rb
#
module Puppet::Parser::Functions
newfunction(:deprecation, :doc => <<-DOC
newfunction(:deprecation, doc: <<-DOC
@summary
Function to print deprecation warnings (this is the 3.X version of it).

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/difference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# difference.rb
#
module Puppet::Parser::Functions
newfunction(:difference, :type => :rvalue, :doc => <<-DOC
newfunction(:difference, type: :rvalue, doc: <<-DOC
@summary
This function returns the difference between two arrays.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/dig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# dig.rb
#
module Puppet::Parser::Functions
newfunction(:dig, :type => :rvalue, :doc => <<-DOC
newfunction(:dig, type: :rvalue, doc: <<-DOC
@summary
**DEPRECATED** Retrieves a value within multiple layers of hashes and arrays via an
array of keys containing a path.
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet/parser/functions/dig44.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
module Puppet::Parser::Functions
newfunction(
:dig44,
:type => :rvalue,
:arity => -2,
:doc => <<-DOC
type: :rvalue,
arity: -2,
doc: <<-DOC
@summary
**DEPRECATED**: Looks up into a complex structure of arrays and hashes and returns a value
or the default value if nothing was found.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/dirname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# dirname.rb
#
module Puppet::Parser::Functions
newfunction(:dirname, :type => :rvalue, :doc => <<-DOC
newfunction(:dirname, type: :rvalue, doc: <<-DOC
@summary
Returns the dirname of a path.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/dos2unix.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Custom Puppet function to convert dos to unix format
module Puppet::Parser::Functions
newfunction(:dos2unix, :type => :rvalue, :arity => 1, :doc => <<-DOC
newfunction(:dos2unix, type: :rvalue, arity: 1, doc: <<-DOC
@summary
Returns the Unix version of the given string.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/downcase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
#
module Puppet::Parser::Functions
newfunction(:downcase, :type => :rvalue, :doc => <<-DOC
newfunction(:downcase, type: :rvalue, doc: <<-DOC
@summary
**Deprecated:** Converts the case of a string or all strings in an array to lower case.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/empty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# empty.rb
#
module Puppet::Parser::Functions
newfunction(:empty, :type => :rvalue, :doc => <<-DOC
newfunction(:empty, type: :rvalue, doc: <<-DOC
@summary
**Deprecated:** Returns true if the variable is empty.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/enclose_ipv6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# enclose_ipv6.rb
#
module Puppet::Parser::Functions
newfunction(:enclose_ipv6, :type => :rvalue, :doc => <<-DOC
newfunction(:enclose_ipv6, type: :rvalue, doc: <<-DOC
@summary
Takes an array of ip addresses and encloses the ipv6 addresses with square brackets.

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/ensure_packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ensure_packages.rb
#
module Puppet::Parser::Functions
newfunction(:ensure_packages, :type => :statement, :doc => <<-DOC
newfunction(:ensure_packages, type: :statement, doc: <<-DOC
@summary
Takes a list of packages and only installs them if they don't already exist.

Expand Down
Loading