Skip to content

Commit

Permalink
deal with 0.37.2 renamed cops
Browse files Browse the repository at this point in the history
252  Style/TrailingCommaInLiteral
84   Style/TrailingCommaInArguments
15   Style/SpaceAroundKeyword
--
351  Total

We already dealt with SpaceAroundKeyword under its old name
SpaceBeforeModifierKeyword, it looks like it got stricter about
spaces after keywords.

TrailingComma also got split, and it looks like the
TrailingCommaInArguments behavior is new?
  • Loading branch information
lamont-granquist committed Feb 19, 2016
1 parent 8f9a0db commit 6077b99
Show file tree
Hide file tree
Showing 102 changed files with 351 additions and 351 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def normalize(data_bag_item, entry)
# chef_type and data_bag come back in PUT and POST results, but we don't
# use those in knife-essentials.
normalize_hash(data_bag_item, {
"id" => remove_dot_json(entry.name)
"id" => remove_dot_json(entry.name),
},)
end

Expand Down
10 changes: 5 additions & 5 deletions lib/chef/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def name(arg = nil)
set_or_return(
:name,
arg,
{ :regex => /^[\-[:alnum:]_]+$/, :kind_of => String }
{ :regex => /^[\-[:alnum:]_]+$/, :kind_of => String },
)
end

Expand Down Expand Up @@ -102,19 +102,19 @@ def cookbook_versions(arg = nil)
{
:kind_of => Hash,
:callbacks => {
"should be a valid set of cookbook version requirements" => lambda { |cv| Chef::Environment.validate_cookbook_versions(cv) }
"should be a valid set of cookbook version requirements" => lambda { |cv| Chef::Environment.validate_cookbook_versions(cv) },
},
},
)
end

def cookbook(cookbook, version)
validate({
:version => version
:version => version,
}, {
:version => {
:callbacks => { "should be a valid version requirement" => lambda { |v| Chef::Environment.validate_cookbook_version(v) } }
}
:callbacks => { "should be a valid version requirement" => lambda { |v| Chef::Environment.validate_cookbook_version(v) } },
},
},)
@cookbook_versions[cookbook] = version
end
Expand Down
12 changes: 6 additions & 6 deletions lib/chef/file_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ def move_to(file, path)
def load(path, read = true)
validate(
{
:path => path
:path => path,
},
{
:path => { :kind_of => String }
:path => { :kind_of => String },
},
)
cache_path = create_cache_path(path, false)
Expand All @@ -131,10 +131,10 @@ def load(path, read = true)
def delete(path)
validate(
{
:path => path
:path => path,
},
{
:path => { :kind_of => String }
:path => { :kind_of => String },
},
)
cache_path = create_cache_path(path, false)
Expand Down Expand Up @@ -178,10 +178,10 @@ def find(glob_pattern)
def has_key?(path)
validate(
{
:path => path
:path => path,
},
{
:path => { :kind_of => String }
:path => { :kind_of => String },
},
)
full_path = create_cache_path(path, false)
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def expiration_date(arg = nil)

def to_hash
result = {
@actor_field_name => @actor
@actor_field_name => @actor,
}
result["name"] = @name if @name
result["public_key"] = @public_key if @public_key
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/knife/data_bag_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def run
Chef::EncryptedDataBagItem.encrypt_data_bag_item(output, read_secret)
else
output
end
end,
)
item.data_bag(@data_bag_name)
rest.post("data/#{@data_bag_name}", item)
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/mixin/securable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def mode(arg = nil)
else
Integer(m) <= 07777 && Integer(m) >= 0
end
}
},
},
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/mixin/windows_env_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def broadcast_env_change
Chef::ReservedNames::Win32::Error.raise!
end
if SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string(
utf8_to_wide("Environment")
utf8_to_wide("Environment"),
).address, flags, 5000, nil) == 0
Chef::ReservedNames::Win32::Error.raise!
end
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/monologger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def create_logfile(filename)

def add_log_header(file)
file.write(
"# Logfile created on %s by %s\n" % [Time.now.to_s, Logger::ProgName]
"# Logfile created on %s by %s\n" % [Time.now.to_s, Logger::ProgName],
)
end

Expand Down
4 changes: 2 additions & 2 deletions lib/chef/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def name(arg = nil)
{ :name => arg },
{ :name => { :kind_of => String,
:cannot_be => :blank,
:regex => /^[\-[:alnum:]_:.]+$/ }
:regex => /^[\-[:alnum:]_:.]+$/ },
},)
@name = arg
else
Expand All @@ -126,7 +126,7 @@ def chef_environment(arg = nil)
set_or_return(
:chef_environment,
arg,
{ :regex => /^[\-[:alnum:]_]+$/, :kind_of => String }
{ :regex => /^[\-[:alnum:]_]+$/, :kind_of => String },
)
end

Expand Down
16 changes: 8 additions & 8 deletions lib/chef/platform/provider_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ def set(args)
:required => false,
},
:resource => {
:kind_of => Symbol
:kind_of => Symbol,
},
:provider => {
:kind_of => [ String, Symbol, Class ]
:kind_of => [ String, Symbol, Class ],
},
},
)
Expand All @@ -133,14 +133,14 @@ def set(args)
platforms[args[:platform]][args[:version]][args[:resource].to_sym] = args[:provider]
else
platforms[args[:platform]][args[:version]] = {
args[:resource].to_sym => args[:provider]
args[:resource].to_sym => args[:provider],
}
end
else
platforms[args[:platform]] = {
args[:version] => {
args[:resource].to_sym => args[:provider]
}
args[:resource].to_sym => args[:provider],
},
}
end
else
Expand All @@ -155,8 +155,8 @@ def set(args)
else
platforms[args[:platform]] = {
:default => {
args[:resource].to_sym => args[:provider]
}
args[:resource].to_sym => args[:provider],
},
}
end
end
Expand All @@ -165,7 +165,7 @@ def set(args)
platforms[:default][args[:resource].to_sym] = args[:provider]
else
platforms[:default] = {
args[:resource].to_sym => args[:provider]
args[:resource].to_sym => args[:provider],
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/platform/service_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def systemd_is_init?
def has_systemd_service_unit?(svc_name)
%w{ /etc /usr/lib /lib /run }.any? do |load_path|
::File.exist?(
Chef.path_to("#{load_path}/systemd/system/#{svc_name.gsub(/@.*$/, '@')}.service")
Chef.path_to("#{load_path}/systemd/system/#{svc_name.gsub(/@.*$/, '@')}.service"),
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/chef/policy_builder/expand_node_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def temporary_policy?

def setup_run_list_override
runlist_override_sanity_check!
unless(override_runlist.empty?)
unless override_runlist.empty?
node.override_runlist(*override_runlist)
Chef::Log.warn "Run List override has been provided."
Chef::Log.warn "Original Run List: [#{node.primary_runlist}]"
Expand All @@ -253,7 +253,7 @@ def runlist_override_sanity_check!
end
@override_runlist = [override_runlist].flatten.compact
override_runlist.map! do |item|
if(item.is_a?(Chef::RunList::RunListItem))
if item.is_a?(Chef::RunList::RunListItem)
item
else
Chef::RunList::RunListItem.new(item)
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/provider/execute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def creates_relative?

def sentinel_file
Pathname.new(Chef::Util::PathHelper.cleanpath(
( cwd && creates_relative? ) ? ::File.join(cwd, creates) : creates
( cwd && creates_relative? ) ? ::File.join(cwd, creates) : creates,
))
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/provider/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def compare_group
@change_desc << "change gid #{@current_resource.gid} to #{@new_resource.gid}"
end

if(@new_resource.append)
if @new_resource.append
missing_members = []
@new_resource.members.each do |member|
next if has_current_group_member?(member)
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/provider/group/dscl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def load_current_resource
def get_free_gid(search_limit = 1000)
gid = nil; next_gid_guess = 200
groups_gids = safe_dscl("list /Groups gid")
while(next_gid_guess < search_limit + 200)
while next_gid_guess < search_limit + 200
if groups_gids =~ Regexp.new("#{Regexp.escape(next_gid_guess.to_s)}\n")
next_gid_guess += 1
else
Expand Down
4 changes: 2 additions & 2 deletions lib/chef/provider/launchd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Launchd < Chef::Provider
:path,
:source,
:session_type,
:type
:type,
]

def load_current_resource
Expand All @@ -51,7 +51,7 @@ def load_current_resource
def gen_path_from_type
types = {
"daemon" => "/Library/LaunchDaemons/#{label}.plist",
"agent" => "/Library/LaunchAgents/#{label}.plist"
"agent" => "/Library/LaunchAgents/#{label}.plist",
}
types[type]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/provider/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def load_current_resource
if file_class.symlink?(@current_resource.target_file)
@current_resource.link_type(:symbolic)
@current_resource.to(
canonicalize(file_class.readlink(@current_resource.target_file))
canonicalize(file_class.readlink(@current_resource.target_file)),
)
else
@current_resource.link_type(:hard)
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/provider/mount/mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def mountable?
# only check for existence of non-remote devices
if device_should_exist? && !::File.exists?(device_real)
raise Chef::Exceptions::Mount, "Device #{@new_resource.device} does not exist"
elsif( @new_resource.mount_point != "none" && !::File.exists?(@new_resource.mount_point) )
elsif @new_resource.mount_point != "none" && !::File.exists?(@new_resource.mount_point)
raise Chef::Exceptions::Mount, "Mount point #{@new_resource.mount_point} does not exist"
end
return true
Expand Down
6 changes: 3 additions & 3 deletions lib/chef/provider/osx_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def load_current_resource
all_profiles = get_installed_profiles
@new_resource.profile(
@new_resource.profile ||
@new_resource.profile_name
@new_resource.profile_name,
)

@new_profile_hash = get_profile_hash(@new_resource.profile)
Expand Down Expand Up @@ -141,7 +141,7 @@ def cookbook_file_available?(cookbook_file)

def get_cache_dir
cache_dir = Chef::FileCache.create_cache_path(
"profiles/#{@new_resource.cookbook_name}"
"profiles/#{@new_resource.cookbook_name}",
)
end

Expand All @@ -151,7 +151,7 @@ def cache_cookbook_profile(cookbook_file)
"profiles",
@new_resource.cookbook_name,
::File.dirname(cookbook_file),
)
),
)
remote_file = Chef::Resource::CookbookFile.new(
::File.join(
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/provider/package/chocolatey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def choco_exe
# lets us mock out an incorrect value for testing.
def choco_install_path
@choco_install_path ||= powershell_out!(
PATHFINDING_POWERSHELL_COMMAND
PATHFINDING_POWERSHELL_COMMAND,
).stdout.chomp
end

Expand Down
2 changes: 1 addition & 1 deletion lib/chef/provider/package/pacman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def candidate_version

repos = %w{extra core community}

if(::File.exists?("/etc/pacman.conf"))
if ::File.exists?("/etc/pacman.conf")
pacman = ::File.read("/etc/pacman.conf")
repos = pacman.scan(/\[(.+)\]/).flatten
end
Expand Down
4 changes: 2 additions & 2 deletions lib/chef/provider/package/paludis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def load_current_resource
end

def install_package(name, version)
if(version)
if version
pkg = "=#{name}-#{version}"
else
pkg = "#{@new_resource.package_name}"
Expand All @@ -67,7 +67,7 @@ def upgrade_package(name, version)
end

def remove_package(name, version)
if(version)
if version
pkg = "=#{@new_resource.package_name}-#{version}"
else
pkg = "#{@new_resource.package_name}"
Expand Down
6 changes: 3 additions & 3 deletions lib/chef/provider/package/portage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def load_current_resource
globsafe_pkg = Chef::Util::PathHelper.escape_glob(pkg)
possibilities = Dir["/var/db/pkg/#{globsafe_category || "*"}/#{globsafe_pkg}-*"].map { |d| d.sub(%r{/var/db/pkg/}, "") }
versions = possibilities.map do |entry|
if(entry =~ %r{[^/]+/#{Regexp.escape(pkg)}\-(\d[\.\d]*((_(alpha|beta|pre|rc|p)\d*)*)?(-r\d+)?)})
if entry =~ %r{[^/]+/#{Regexp.escape(pkg)}\-(\d[\.\d]*((_(alpha|beta|pre|rc|p)\d*)*)?(-r\d+)?)}
[$&, $1]
end
end.compact
Expand Down Expand Up @@ -108,7 +108,7 @@ def candidate_version
def install_package(name, version)
pkg = "=#{name}-#{version}"

if(version =~ /^\~(.+)/)
if version =~ /^\~(.+)/
# If we start with a tilde
pkg = "~#{name}-#{$1}"
end
Expand All @@ -121,7 +121,7 @@ def upgrade_package(name, version)
end

def remove_package(name, version)
if(version)
if version
pkg = "=#{@new_resource.package_name}-#{version}"
else
pkg = "#{@new_resource.package_name}"
Expand Down
2 changes: 1 addition & 1 deletion lib/chef/provider/service/gentoo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def load_current_resource
readable = ::File.readable? file
Chef::Log.debug "#{@new_resource} exists: #{exists}, readable: #{readable}"
exists and readable
end
end,
)
Chef::Log.debug "#{@new_resource} enabled: #{@current_resource.enabled}"

Expand Down
Loading

0 comments on commit 6077b99

Please sign in to comment.