ministryofjustice/prison-visits

View on GitHub
.default_rubocop.yml

Summary

Maintainability
Test Coverage
require: rubocop-rspec

# private/protected/public
Style/AccessModifierIndentation:
  EnforcedStyle: outdent

# Just indent parameters by two spaces. It's less volatile if methods change,
# and there's less busy work lining things up.
Style/AlignParameters:
  EnforcedStyle: with_fixed_indentation

# Use Weirich style
Style/BlockDelimiters:
  EnforcedStyle: semantic

# Allow ===. It's useful.
Style/CaseEquality:
  Enabled: false

Style/CollectionMethods:
  PreferredMethods:
    inject: 'inject'
    reduce: 'inject'

Style/ConstantName:
  Enabled: true

# Chain methods with trailing dots.
Style/DotPosition:
  EnforcedStyle: trailing

Style/EachWithObject:
  Enabled: false

# Percent-formatting and hash interpolation both have their place. Don't
# enforce any particular one.
Style/FormatString:
  Enabled: false

# It's not really clearer to replace every if with a return if.
Style/GuardClause:
  Enabled: false

Style/WordArray:
  Exclude:
    - 'spec/**/*'

Metrics/ClassLength:
  Exclude:
    - 'app/models/**/*'

Metrics/LineLength:
  Max: 80
  Exclude:
    - 'spec/**/*'
    - 'test/**/*'

# Don't worry about long methods in specs.
Metrics/MethodLength:
  Max: 10
  Exclude:
    - 'spec/**/*'
    - 'test/**/*'

# Enforce single quotes everywhere except in specs (because there's a lot of
# human text with apostrophes in spec names, and using double quotes for all
# of those is more consistent. There shouldn't be much human-readable text in
# the application code: that is better moved to the locale files.
Style/StringLiterals:
  EnforcedStyle: single_quotes
  Exclude:
    - 'spec/**/*'

# Allow us to define simple predicate methods like foo? that look at the value
# of @foo. See https://github.com/bbatsov/rubocop/issues/2140
Style/TrivialAccessors:
  AllowPredicates: true

# 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

# Don't allow safe assignment in conditions.
Lint/AssignmentInCondition:
  AllowSafeAssignment: false

# Just a preference to use %w[] over %w()
Style/PercentLiteralDelimiters:
  PreferredDelimiters:
    '%i': '[]'
    '%w': '[]'
    '%W': '[]'

ClassAndModuleChildren:
  Enabled: false

RSpec/DescribeClass:
  Exclude:
    - 'spec/features/**/*'