Skip to content

Commit

Permalink
Autocorrect Rubocop's Layout/CommentIndentation cop
Browse files Browse the repository at this point in the history
  • Loading branch information
sauloperez committed Apr 23, 2018
1 parent 3fc49d5 commit 11081ab
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 52 deletions.
7 changes: 0 additions & 7 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,6 @@ Layout/AlignParameters:
- 'spec/lib/open_food_network/user_balance_calculator_spec.rb'
- 'spec/support/request/authentication_workflow.rb'

# Offense count: 8
# Cop supports --auto-correct.
Layout/CommentIndentation:
Exclude:
- 'Guardfile'
- 'lib/open_food_network/packing_report.rb'

# Offense count: 8
# Cop supports --auto-correct.
Layout/ElseAlignment:
Expand Down
40 changes: 1 addition & 39 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,7 @@ guard 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
#watch(%r{config/locales/.+\.yml})

# Rails Assets Pipeline
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
end


#guard 'rails' do
#watch('Gemfile.lock')
#watch(%r{^(config|lib)/.*})
#end


#guard 'zeus' do
## uses the .rspec file
## --colour --fail-fast --format documentation --tag ~slow
#watch(%r{^spec/.+_spec\.rb$})
#watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
#watch(%r{^app/(.+)\.haml$}) { |m| "spec/#{m[1]}.haml_spec.rb" }
#watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
#watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
#end

#guard :rspec do
#watch(%r{^spec/.+_spec\.rb$})
#watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
#watch('spec/spec_helper.rb') { "spec" }

## Rails example
#watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
#watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
#watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
#watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
#watch('config/routes.rb') { "spec/routing" }
#watch('app/controllers/application_controller.rb') { "spec/controllers" }

## Capybara features specs
#watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }

## Turnip features and steps
#watch(%r{^spec/acceptance/(.+)\.feature$})
#watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
#end
6 changes: 0 additions & 6 deletions lib/open_food_network/packing_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ def table_items

def rules
if is_by_customer?
# customer_rows orders
# table_items = @line_items

[
{ group_by: proc { |line_item| line_item.order.distributor },
sort_by: proc { |distributor| distributor.name } },
Expand All @@ -84,9 +81,6 @@ def rules
sort_by: proc { |full_name| full_name } }
]
else
# supplier_rows orders
# table_items = supplier_rows orders
#
[ { group_by: proc { |line_item| line_item.order.distributor },
sort_by: proc { |distributor| distributor.name } },
{ group_by: proc { |line_item| line_item.product.supplier },
Expand Down
10 changes: 10 additions & 0 deletions script/rubocop_autocorrect
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#!/bin/sh

# Usage
#
# 1. Clean any git unstagged or untracked changes. Consider creating a new branch
# 2. Remove a cop's exclusion paragraph from the .rubocop_todo.yml
# 3. Run:
#
# $ ./script/rubocop_autocorrect <removed_cop_name>
#
# This will commit all the changes.

set -e

COP="$1"
Expand Down

0 comments on commit 11081ab

Please sign in to comment.