Skip to content
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

Add metadata to default.yml #41

Merged
merged 1 commit into from
Mar 1, 2019
Merged
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
61 changes: 61 additions & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ AllCops:
Rails/ActionFilter:
Description: 'Enforces consistent use of action filter methods.'
Enabled: true
VersionAdded: '0.19'
EnforcedStyle: action
SupportedStyles:
- action
Expand All @@ -26,25 +27,30 @@ Rails/ActiveRecordAliases:
Use `update` instead of `update_attributes`.
Use `update!` instead of `update_attributes!`.
Enabled: true
VersionAdded: '0.53'

Rails/ActiveSupportAliases:
Description: >-
Avoid ActiveSupport aliases of standard ruby methods:
`String#starts_with?`, `String#ends_with?`,
`Array#append`, `Array#prepend`.
Enabled: true
VersionAdded: '0.48'

Rails/ApplicationJob:
Description: 'Check that jobs subclass ApplicationJob.'
Enabled: true
VersionAdded: '0.49'

Rails/ApplicationRecord:
Description: 'Check that models subclass ApplicationRecord.'
Enabled: true
VersionAdded: '0.49'

Rails/AssertNot:
Description: 'Use `assert_not` instead of `assert !`.'
Enabled: true
VersionAdded: '0.56'
Include:
- '**/test/**/*'

Expand All @@ -53,10 +59,12 @@ Rails/BelongsTo:
Use `optional: true` instead of `required: false` for
`belongs_to` relations'
Enabled: true
VersionAdded: '0.62'

Rails/Blank:
Description: 'Enforces use of `blank?`.'
Enabled: true
VersionAdded: '0.48'
# Convert usages of `nil? || empty?` to `blank?`
NilOrEmpty: true
# Convert usages of `!present?` to `blank?`
Expand All @@ -67,6 +75,7 @@ Rails/Blank:
Rails/BulkChangeTable:
Description: 'Check whether alter queries are combinable.'
Enabled: true
VersionAdded: '0.57'
Database: null
SupportedDatabases:
- mysql
Expand All @@ -79,6 +88,7 @@ Rails/CreateTableWithTimestamps:
Checks the migration for which timestamps are not included
when creating a new table.
Enabled: true
VersionAdded: '0.52'
Include:
- db/migrate/*.rb

Expand All @@ -87,6 +97,8 @@ Rails/Date:
Checks the correct usage of date aware methods,
such as Date.today, Date.current etc.
Enabled: true
VersionAdded: '0.30'
VersionChanged: '0.33'
# The value `strict` disallows usage of `Date.today`, `Date.current`,
# `Date#to_time` etc.
# The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
Expand All @@ -100,6 +112,8 @@ Rails/Date:
Rails/Delegate:
Description: 'Prefer delegate method for delegations.'
Enabled: true
VersionAdded: '0.21'
VersionChanged: '0.50'
# When set to true, using the target object as a prefix of the
# method name without using the `delegate` method will be a
# violation. When set to false, this case is legal.
Expand All @@ -108,30 +122,35 @@ Rails/Delegate:
Rails/DelegateAllowBlank:
Description: 'Do not use allow_blank as an option to delegate.'
Enabled: true
VersionAdded: '0.44'

Rails/DynamicFindBy:
Description: 'Use `find_by` instead of dynamic `find_by_*`.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
Enabled: true
VersionAdded: '0.44'
Whitelist:
- find_by_sql

Rails/EnumUniqueness:
Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
Enabled: true
VersionAdded: '0.46'
Include:
- app/models/**/*.rb

Rails/EnvironmentComparison:
Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
Enabled: true
VersionAdded: '0.52'

Rails/Exit:
Description: >-
Favor `fail`, `break`, `return`, etc. over `exit` in
application or library code outside of Rake files to avoid
exits during unit testing or running in production.
Enabled: true
VersionAdded: '0.41'
Include:
- app/**/*.rb
- config/**/*.rb
Expand All @@ -142,6 +161,8 @@ Rails/Exit:
Rails/FilePath:
Description: 'Use `Rails.root.join` for file path joining.'
Enabled: true
VersionAdded: '0.47'
VersionChanged: '0.57'
EnforcedStyle: arguments
SupportedStyles:
- slashes
Expand All @@ -151,46 +172,53 @@ Rails/FindBy:
Description: 'Prefer find_by over where.first.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
Enabled: true
VersionAdded: '0.30'
Include:
- app/models/**/*.rb

Rails/FindEach:
Description: 'Prefer all.find_each over all.find.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
Enabled: true
VersionAdded: '0.30'
Include:
- app/models/**/*.rb

Rails/HasAndBelongsToMany:
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
Enabled: true
VersionAdded: '0.12'
Include:
- app/models/**/*.rb

Rails/HasManyOrHasOneDependent:
Description: 'Define the dependent option to the has_many and has_one associations.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
Enabled: true
VersionAdded: '0.50'
Include:
- app/models/**/*.rb

Rails/HelperInstanceVariable:
Description: 'Do not use instance variables in helpers'
Enabled: true
VersionAdded: '2.0'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 This new police exists only in RuboCop Rails. (If we backport to RuboCop core, I think that we will change the version at that time.)

I'd like to try to merge this version 2.0 if there is no problem. WDYT?

Include:
- app/helpers/**/*.rb

Rails/HttpPositionalArguments:
Description: 'Use keyword arguments instead of positional arguments in http method calls.'
Enabled: true
VersionAdded: '0.44'
Include:
- 'spec/**/*'
- 'test/**/*'

Rails/HttpStatus:
Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
Enabled: true
VersionAdded: '0.54'
EnforcedStyle: symbolic
SupportedStyles:
- numeric
Expand All @@ -200,36 +228,43 @@ Rails/IgnoredSkipActionFilterOption:
Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
Enabled: true
VersionAdded: '0.63'
Include:
- app/controllers/**/*.rb

Rails/InverseOf:
Description: 'Checks for associations where the inverse cannot be determined automatically.'
Enabled: true
VersionAdded: '0.52'
Include:
- app/models/**/*.rb

Rails/LexicallyScopedActionFilter:
Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
Enabled: true
VersionAdded: '0.52'
Include:
- app/controllers/**/*.rb

Rails/LinkToBlank:
Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
Reference: https://mathiasbynens.github.io/rel-noopener/
Enabled: true
VersionAdded: '0.62'

Rails/NotNullColumn:
Description: 'Do not add a NOT NULL column without a default value'
Enabled: true
VersionAdded: '0.43'
Include:
- db/migrate/*.rb

Rails/Output:
Description: 'Checks for calls to puts, print, etc.'
Enabled: true
VersionAdded: '0.15'
VersionChanged: '0.19'
Include:
- app/**/*.rb
- config/**/*.rb
Expand All @@ -239,18 +274,22 @@ Rails/Output:
Rails/OutputSafety:
Description: 'The use of `html_safe` or `raw` may be a security risk.'
Enabled: true
VersionAdded: '0.41'

Rails/PluralizationGrammar:
Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
Enabled: true
VersionAdded: '0.35'

Rails/Presence:
Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
Enabled: true
VersionAdded: '0.52'

Rails/Present:
Description: 'Enforces use of `present?`.'
Enabled: true
VersionAdded: '0.48'
# Convert usages of `!nil? && !empty?` to `present?`
NotNilAndNotEmpty: true
# Convert usages of `!blank?` to `present?`
Expand All @@ -264,31 +303,39 @@ Rails/ReadWriteAttribute:
write_attribute(:attr, val).
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
Enabled: true
VersionAdded: '0.20'
VersionChanged: '0.29'
Include:
- app/models/**/*.rb

Rails/RedundantReceiverInWithOptions:
Description: 'Checks for redundant receiver in `with_options`.'
Enabled: true
VersionAdded: '0.52'

Rails/ReflectionClassName:
Description: 'Use a string for `class_name` option value in the definition of a reflection.'
Enabled: true
VersionAdded: '0.64'

Rails/RefuteMethods:
Description: 'Use `assert_not` methods instead of `refute` methods.'
Enabled: true
VersionAdded: '0.56'
Include:
- '**/test/**/*'

Rails/RelativeDateConstant:
Description: 'Do not assign relative date to constants.'
Enabled: true
VersionAdded: '0.48'
VersionChanged: '0.59'
AutoCorrect: false

Rails/RequestReferer:
Description: 'Use consistent syntax for request.referer.'
Enabled: true
VersionAdded: '0.41'
EnforcedStyle: referer
SupportedStyles:
- referer
Expand All @@ -299,12 +346,14 @@ Rails/ReversibleMigration:
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
Enabled: true
VersionAdded: '0.47'
Include:
- db/migrate/*.rb

Rails/SafeNavigation:
Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
Enabled: true
VersionAdded: '0.43'
# This will convert usages of `try` to use safe navigation as well as `try!`.
# `try` and `try!` work slightly differently. `try!` and safe navigation will
# both raise a `NoMethodError` if the receiver of the method call does not
Expand All @@ -315,12 +364,15 @@ Rails/SaveBang:
Description: 'Identifies possible cases where Active Record save! or related should be used.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
Enabled: false
VersionAdded: '0.42'
VersionChanged: '0.59'
AllowImplicitReturn: true
AllowedReceivers: []

Rails/ScopeArgs:
Description: 'Checks the arguments of ActiveRecord scopes.'
Enabled: true
VersionAdded: '0.19'
Include:
- app/models/**/*.rb

Expand All @@ -330,6 +382,8 @@ Rails/SkipsModelValidations:
See reference for more information.
Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
Enabled: true
VersionAdded: '0.47'
VersionChanged: '0.60'
Blacklist:
- decrement!
- decrement_counter
Expand All @@ -349,6 +403,8 @@ Rails/TimeZone:
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
Enabled: true
VersionAdded: '0.30'
VersionChanged: '0.33'
# The value `strict` means that `Time` should be used with `zone`.
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
EnforcedStyle: flexible
Expand All @@ -359,6 +415,8 @@ Rails/TimeZone:
Rails/UniqBeforePluck:
Description: 'Prefer the use of uniq or distinct before pluck.'
Enabled: true
VersionAdded: '0.40'
VersionChanged: '0.47'
EnforcedStyle: conservative
SupportedStyles:
- conservative
Expand All @@ -368,6 +426,7 @@ Rails/UniqBeforePluck:
Rails/UnknownEnv:
Description: 'Use correct environment name.'
Enabled: true
VersionAdded: '0.51'
Environments:
- development
- test
Expand All @@ -376,5 +435,7 @@ Rails/UnknownEnv:
Rails/Validation:
Description: 'Use validates :attribute, hash of validations.'
Enabled: true
VersionAdded: '0.9'
VersionChanged: '0.41'
Include:
- app/models/**/*.rb
Loading