inherit_mode: merge: - Exclude inherit_from: common_rubocop.yml # Enable additional Rails cops Rails: Enabled: true AllCops: Exclude: - 'bin/puma' - 'bin/rails' - 'bin/shoryuken' - 'bin/sidekiq' - 'bin/spring' - 'db/schema.rb' - 'db/migrate/**/*' # Rails project's are not concerned with API docs normally Documentation: Enabled: false Metrics/BlockLength: Exclude: - 'spec/rails_helper.rb' # Rails foreign keys and indexes can get long. We want to ignore our annotation # comments which are for these entries. # # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Metrics/LineLength: IgnoredPatterns: - '\A# fk_rails_' - '\A# index_' # As Rails defaults to creating timestamps you need to go out of your way to # explicitly have them removed from the table. This cop is almost always a # false negative so we're disabling it. # # Configuration parameters: Include. # Include: db/migrate/*.rb Rails/CreateTableWithTimestamps: Enabled: false # The ActiveSupport monkey patches for `present?` are nearly all defiend as: # # !blank? # # For most of use `unless blank?` reads just as easily as `if present?`. # Sometimes contextually, it can read better depending on the branch logic and # surrounding context. As `if present?` requires an additional negation and # method call it is technically slower. In the general case the perf different # isn't much but in some cases it matters. Thus, we are not enforcing changing # `unless blank?` to `if present?` and are leaving it up to the context to # decide which is a better fit. # # Cop supports --auto-correct. # Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank. Rails/Present: UnlessBlank: false # We prefer you use the attribute readers and writes. For those special cases # where the intent is really to interact with the raw underlying attribute we # prefer `read_attribute` and `write_attribute`; as this makes the intent # explict. Ideally we'd never use the hash like accessor `[:attr]`. # # We disable this cop because it is not configurable. # # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/ReadWriteAttribute: Enabled: false # According to the Rails docs while the following methods skip validations they # only update the specified (single) attribute reducing risks. We'd rather not # warn for those cases: # # - decrement! # - increment! # - touch # # We are not excluding `toggle!` because it's more likely that a flag may have # validations associated with it (or is used by other validations). # # See: # # - http://api.rubyonrails.org/classes/ActiveRecord/CounterCache/ClassMethods.html # - http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html # - http://api.rubyonrails.org/classes/ActiveRecord/Relation.html # # Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters Rails/SkipsModelValidations: Blacklist: - 'decrement_counter' - 'increment_counter' - 'toggle!' - 'update_all' - 'update_attribute' - 'update_column' - 'update_columns' - 'update_counters' # Rails uses compact style by default so we're disabling this with a :hammer: # for things likely to be generated by Rails (i.e. most things in app). # # Configuration parameters: AutoCorrect, EnforcedStyle. # SupportedStyles: nested, compact Style/ClassAndModuleChildren: Exclude: - 'app/**/*'