Skip to content

Commit

Permalink
Update rubocop.yml and resolve some warnings
Browse files Browse the repository at this point in the history
Some of the rule names have changed so the file had to be updated
  • Loading branch information
tas50 committed Aug 10, 2015
1 parent 942f06d commit 2645800
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 26 deletions.
20 changes: 11 additions & 9 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ AllCops:
- cookbooks/**
- bin/**

# allow for alignment of indentations
Style/SingleSpaceBeforeFirstArg:
Enabled: false

# Let's not argue over this...
StringLiterals:
EnforcedStyle: double_quotes
Expand All @@ -16,15 +20,13 @@ DotPosition:

# Whitespace between modules/classes/methods can be helpful to read and
# don't hurt anybody.
EmptyLinesAroundBody:
Style/EmptyLinesAroundBlockBody:
Enabled: false

# I very much agree with the Jim Weirich school of thought on usage of do/end
# vs. {...}:
# * http://devblog.avdi.org/2011/07/26/the-procedurefunction-block-convention-in-ruby/
# * http://talklikeaduck.denhaven2.com/2007/10/02/ruby-blocks-do-or-brace
# * http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc
Blocks:
Style/EmptyLinesAroundClassBody:
Enabled: false
Style/EmptyLinesAroundMethodBody:
Enabled: false
Style/EmptyLinesAroundModuleBody:
Enabled: false

# When this is useful, it's useful, every other time it's entirely surprising
Expand Down Expand Up @@ -56,7 +58,7 @@ ParenthesesAsGroupedExpression:
BracesAroundHashParameters:
Enabled: false

# Emacs ruby-mode handles this just fine thanks
# Emacs ruby-mode handles this just fine thanks
IndentHash:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def find_carbon_cache_services(node)
caches = []
case node['graphite']['carbon']['service_type']
when 'runit'
node['graphite']['carbon']['caches'].each do |instance, data|
node['graphite']['carbon']['caches'].each do |instance, _data|
caches << "runit_service[carbon-cache-#{instance}]"
end
else
Expand Down
4 changes: 1 addition & 3 deletions recipes/_web_packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
node['graphite']['package_names']['graphite_web'][key]
}
version lazy {
if node['graphite']['install_type'] == 'package'
node['graphite']['version']
end
node['graphite']['version'] if node['graphite']['install_type'] == 'package'
}
end
10 changes: 5 additions & 5 deletions spec/libraries/chef_graphite_python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@

it "renders a nested hash with mixed values" do
expect(writer.pythonize(
"jazzhands" => ["tap", true, 100],
"tap" => { purple: 'pants' },
"jazzercise" => false,
"icedance" => 1)).to eq(
"{'jazzhands': ['tap', True, 100], 'tap': {'purple': 'pants'}, 'jazzercise': False, 'icedance': 1}")
"jazzhands" => ["tap", true, 100],
"tap" => { purple: 'pants' },
"jazzercise" => false,
"icedance" => 1)).to eq(
"{'jazzhands': ['tap', True, 100], 'tap': {'purple': 'pants'}, 'jazzercise': False, 'icedance': 1}")
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/providers/web_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

it "inserts a header" do
expect(content).to match(regexify_line(
"# This file is managed by Chef, your changes *will* be overwritten!"
"# This file is managed by Chef, your changes *will* be overwritten!"
))
end

Expand Down
4 changes: 2 additions & 2 deletions spec/recipes/_carbon_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
it "installs carbon from a url with no version set" do
expect(chef_run).to install_python_pip("carbon").
with(
version: nil,
package_name: "https://github.com/graphite-project/graphite-web/zipball/master"
version: nil,
package_name: "https://github.com/graphite-project/graphite-web/zipball/master"
)
end

Expand Down
3 changes: 2 additions & 1 deletion spec/recipes/_web_packages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

context "on centos" do

let(:runner) do ChefSpec::Runner.new(
let(:runner) do
ChefSpec::Runner.new(
platform: "centos", version: "6.5"
).tap { |runner| runner.node.set["platform_family"] = "rhel" }
end
Expand Down
8 changes: 4 additions & 4 deletions spec/support/example_groups/provider_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module ProviderExampleGroup
def using_lw_resource(cookbook, lwrp)
name = class_name_for_lwrp(cookbook, lwrp)
resource_file = run_context.cookbook_collection[cookbook].
resource_filenames.find { |f| ::File.basename(f, ".rb") == lwrp }
resource_filenames.find { |f| ::File.basename(f, ".rb") == lwrp }

using_libraries(cookbook)

Expand All @@ -20,7 +20,7 @@ def using_lw_resource(cookbook, lwrp)
def using_lw_provider(cookbook, lwrp)
name = class_name_for_lwrp(cookbook, lwrp)
resource_file = run_context.cookbook_collection[cookbook].
provider_filenames.find { |f| ::File.basename(f, ".rb") == lwrp }
provider_filenames.find { |f| ::File.basename(f, ".rb") == lwrp }

using_libraries(cookbook)

Expand All @@ -34,8 +34,8 @@ def using_lw_provider(cookbook, lwrp)
end

def using_libraries(cookbook)
run_context.cookbook_collection[cookbook].library_filenames.each do
|f| require(f)
run_context.cookbook_collection[cookbook].library_filenames.each do |f|
require(f)
end
end

Expand Down

0 comments on commit 2645800

Please sign in to comment.