inherit_from: - .rubocop_todo.yml AllCops: TargetRubyVersion: 2.5 # Exclude anything that isn't really part of our code. # rails_helper is excluded because it's full of solecisms, but it's mostly # generated code and copy-and-pasted snipets from READMEs. Exclude: - 'bin/**/*' - '**/*.gemspec' - '**/Rakefile' - 'Gemfile' # Allow long lines in specs, as it's almost impossible to fit RSpec's # expectations into 80 characters. Metrics/LineLength: Max: 180 Exclude: - 'spec/**/*' - 'Gemfile' Metrics/ModuleLength: Max: 120 Metrics/AbcSize: Exclude: - 'spec/**/*' # Allow expect {}.to blocks in specs # but not in the code Style/BlockDelimiters: Enabled: true Exclude: - 'spec/**/*' Style/AsciiComments: Enabled: true Exclude: - 'spec/**/*' Layout/TrailingBlankLines: Enabled: true # Don't worry about long methods in specs. Metrics/MethodLength: Max: 15 Exclude: - 'spec/**/*' # No need to check for describe class param in support files. RSpec/DescribeClass: Enabled: true # private/protected/public Layout/AccessModifierIndentation: EnforcedStyle: indent # Just indent parameters by two spaces. It's less volatile if methods change, # and there's less busy work lining things up. Layout/AlignParameters: EnforcedStyle: with_fixed_indentation Style/ClassAndModuleChildren: EnforcedStyle: nested Style/CollectionMethods: PreferredMethods: collect: 'map' collect!: 'map!' each_with_object: 'inject' inject: 'inject' reduce: 'inject' detect: 'find' find_all: 'select' # Chain methods with trailing dots. Layout/DotPosition: EnforcedStyle: trailing # No, we don't prefer each_with_object Style/EachWithObject: Enabled: false # Prefer blank line after class/module start. Layout/EmptyLinesAroundClassBody: Enabled: false Layout/EmptyLinesAroundModuleBody: Enabled: false Layout/EmptyLinesAroundBlockBody: Enabled: false # We have a mixture at the moment, so don't enforce anything. Style/FormatString: Enabled: false # It's not really clearer to replace every if with a return if. Style/GuardClause: Enabled: false # Groups of three is not always the right thing for numeric literals Style/NumericLiterals: Enabled: false Style/FrozenStringLiteralComment: Enabled: false # Percent-formatting and hash interpolation both have their place. Don't # enforce any particular one. Style/StringLiterals: Enabled: false # I'm happy with raise, thanks. Style/SignalException: Enabled: false # Let us use foo? methods Style/TrivialAccessors: AllowPredicates: true Style/MixinUsage: Enabled: true Exclude: - 'spec/**/*' - 'features/**/*' # Prefer sensible naming to comments everywhere. Documentation: Description: Document classes and non-namespace modules. Enabled: false # Would enforce do_y if x over if x / do y / end. As with GuardClause above, # this enforces code organisation that doesn't necesarily make things clearer. IfUnlessModifier: Enabled: false # Allow safe assignment in conditions. Lint/AssignmentInCondition: AllowSafeAssignment: false # Just a preference to use %w[] over %w() Style/PercentLiteralDelimiters: PreferredDelimiters: '%w': '[]' '%W': '[]' '%i': '[]' # %w doesn't always make for clearer test data Style/WordArray: EnforcedStyle: brackets Style/SymbolArray: EnforcedStyle: brackets RSpec/NestedGroups: Max: 10 RSpec/ExpectActual: Exclude: - 'spec/routing/**/*' Metrics/BlockLength: Exclude: - 'spec/**/*' - 'test_common/**/*' - 'config/**/*' - 'lib/tasks/**/*' Layout/EmptyLineAfterMagicComment: Enabled: false # --------------- # HttpPositionalArguments is rails 5 only # https://github.com/bbatsov/rubocop/issues/3629 # --------------- Rails/HttpPositionalArguments: Enabled: false RSpec/MultipleExpectations: Exclude: - 'spec/features/**/*' RSpec/ExampleLength: Exclude: - 'spec/**/*' Style/NumericPredicate: Exclude: - 'spec/**/*' Rails/OutputSafety: Exclude: - 'app/helpers/yaml_helper.rb' Capybara/FeatureMethods: Exclude: - 'spec/features/**/*' Naming/PredicateName: Exclude: - 'test_common/**/*' require: rubocop-rspec