Rubocop: Add Rails cops to config and todo

This commit is contained in:
Rob Harrington
2017-05-21 09:28:28 +10:00
parent 33a1d97d5e
commit f79dcaba15
2 changed files with 183 additions and 1 deletions

View File

@@ -2,6 +2,8 @@ inherit_from:
- .rubocop_todo.yml
AllCops:
TargetRubyVersion: 2.1
TargetRailsVersion: 3.2
Include:
- '**/Rakefile'
- '**/config.ru'
@@ -14,6 +16,9 @@ AllCops:
# OFN SETTINGS
# Cop settings that have been agreed upon by the OFN community
Rails:
Enabled: true
Style/Documentation:
Enabled: false
@@ -29,6 +34,15 @@ Style/StringLiterals:
Lint/AmbiguousBlockAssociation:
Enabled: false
# No alternative to this one until we upgrade to Rails 4 and can use #find_by
Rails/DynamicFindBy:
Enabled: false
# This should be the programmer's discretion, perhaps we should review all of
# the uses of it an make specific exceptions though.
Rails/SkipsModelValidations:
Enabled: false
# This should be enfored, but doing so would require changing the entire
# file, so should probably do when outstanding PRS are at a minimum
Style/ClassAndModuleChildren:

View File

@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-05-20 10:48:13 +1000 using RuboCop version 0.48.1.
# on 2017-05-21 09:22:19 +1000 using RuboCop version 0.48.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@@ -213,6 +213,174 @@ Performance/StringReplacement:
- 'app/helpers/spree/admin/navigation_helper_decorator.rb'
- 'app/models/spree/preferences/file_configuration.rb'
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent.
Rails/Blank:
Exclude:
- 'app/controllers/spree/admin/orders_controller_decorator.rb'
- 'app/helpers/enterprises_helper.rb'
- 'app/models/enterprise_group.rb'
- 'app/models/order_cycle.rb'
- 'app/models/spree/variant_decorator.rb'
- 'lib/open_food_network/order_cycle_permissions.rb'
- 'lib/tasks/data.rake'
# Offense count: 3
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: strict, flexible
Rails/Date:
Exclude:
- 'app/models/order_cycle.rb'
- 'spec/controllers/admin/enterprises_controller_spec.rb'
# Offense count: 6
# Cop supports --auto-correct.
Rails/Delegate:
Exclude:
- 'app/models/spree/line_item_decorator.rb'
- 'app/models/spree/product_property_decorator.rb'
- 'app/serializers/api/admin/calculator_serializer.rb'
- 'app/serializers/api/admin/tag_rule_serializer.rb'
- 'app/serializers/api/variant_serializer.rb'
# Offense count: 6
Rails/FilePath:
Exclude:
- 'lib/tasks/karma.rake'
- 'spec/features/admin/content_spec.rb'
- 'spec/models/content_configuration_spec.rb'
- 'spec/models/spree/image_spec.rb'
- 'spec/models/spree/variant_spec.rb'
- 'spec/spec_helper.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/FindBy:
Exclude:
- 'app/models/product_importer.rb'
- 'app/models/variant_override.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/FindEach:
Exclude:
- 'app/models/enterprise.rb'
- 'app/models/spree/user_decorator.rb'
# Offense count: 5
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasAndBelongsToMany:
Exclude:
- 'app/models/enterprise.rb'
- 'app/models/enterprise_group.rb'
- 'app/models/spree/line_item_decorator.rb'
- 'app/models/spree/payment_method_decorator.rb'
# Offense count: 11
Rails/OutputSafety:
Exclude:
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
- 'app/helpers/angular_form_helper.rb'
- 'app/helpers/spree/reports_helper.rb'
- 'app/serializers/api/product_serializer.rb'
- 'lib/spree/money_decorator.rb'
- 'lib/tasks/karma.rake'
# Offense count: 6
# Cop supports --auto-correct.
Rails/PluralizationGrammar:
Exclude:
- 'spec/features/admin/order_cycles_spec.rb'
- 'spec/jobs/update_account_invoices_spec.rb'
- 'spec/jobs/update_billable_periods_spec.rb'
- 'spec/models/order_cycle_spec.rb'
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank.
Rails/Present:
Exclude:
- 'app/controllers/spree/admin/orders_controller_decorator.rb'
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
- 'app/models/producer_property.rb'
- 'lib/open_food_network/products_and_inventory_report.rb'
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/ReadWriteAttribute:
Exclude:
- 'app/models/enterprise.rb'
# Offense count: 46
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/ScopeArgs:
Exclude:
- 'app/models/enterprise.rb'
- 'app/models/enterprise_group.rb'
- 'app/models/enterprise_relationship.rb'
- 'app/models/enterprise_role.rb'
- 'app/models/exchange.rb'
- 'app/models/inventory_item.rb'
- 'app/models/order_cycle.rb'
- 'app/models/spree/adjustment_decorator.rb'
- 'app/models/spree/line_item_decorator.rb'
- 'app/models/spree/payment_method_decorator.rb'
- 'app/models/spree/product_decorator.rb'
- 'app/models/spree/shipping_method_decorator.rb'
- 'app/models/spree/variant_decorator.rb'
# Offense count: 18
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: strict, flexible
Rails/TimeZone:
Exclude:
- 'app/controllers/admin/product_import_controller.rb'
- 'app/controllers/api/statuses_controller.rb'
- 'app/jobs/heartbeat_job.rb'
- 'app/models/enterprise_relationship.rb'
- 'lib/open_food_network/rack_request_blocker.rb'
- 'lib/open_food_network/users_and_enterprises_report.rb'
- 'spec/controllers/api/statuses_controller_spec.rb'
- 'spec/jobs/heartbeat_job_spec.rb'
- 'spec/lib/open_food_network/products_cache_refreshment_spec.rb'
- 'spec/lib/open_food_network/products_cache_spec.rb'
- 'spec/models/enterprise_relationship_spec.rb'
- 'spec/models/variant_override_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AutoCorrect.
# SupportedStyles: conservative, aggressive
Rails/UniqBeforePluck:
Exclude:
- 'lib/open_food_network/sales_tax_report.rb'
# Offense count: 21
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/Validation:
Exclude:
- 'app/models/enterprise.rb'
- 'app/models/enterprise_fee.rb'
- 'app/models/enterprise_relationship.rb'
- 'app/models/enterprise_role.rb'
- 'app/models/exchange.rb'
- 'app/models/order_cycle.rb'
- 'app/models/product_distribution.rb'
- 'app/models/spree/product_decorator.rb'
- 'app/models/spree/variant_decorator.rb'
- 'app/models/variant_override.rb'
# Offense count: 6
Style/AccessorMethodName:
Exclude: