ministryofjustice/atet

View on GitHub
.rubocop.yml

Summary

Maintainability
Test Coverage
AllCops:
  TargetRubyVersion: 3.2.2
  Exclude:
    - 'Guardfile'
    - 'vendor/**/*'
    - 'db/**/*'
    - 'bin/**/*'
    - '**/*.gemspec'
    - '**/Rakefile'
    - '**/Vagrantfile'
    - 'spec/rails_helper.rb'
    - 'lib/tasks/cucumber.rake'
    - 'features/support/env.rb'
    - 'script/cucumber'
    - 'lib/log_stuff.rb'
    - 'config/routes.rb'
    - 'Gemfile'
    - 'spec/support/**/*'
    - 'node_modules/**/*'

# Metrics
Metrics/ClassLength:
  Exclude:
    - 'app/forms/**/*'
    - 'features/support/page_objects/**/*'
    - 'features/support/sections/**/*'
Metrics/ModuleLength:
  Exclude:
    - 'spec/forms/**/*'
    - 'features/support/page_objects/**/*'
    - 'features/support/sections/**/*'
Metrics/AbcSize:
  Exclude:
    - 'spec/**/*'
  Max: 20
Metrics/MethodLength:
  Exclude:
    - 'spec/**/*'
    - 'app/models/ability.rb'
    - 'config/initializers/markdown_handler.rb'
Metrics/BlockLength:
  Exclude:
    - 'config/environments/*.rb'
    - '**/*.jbuilder'
  Max: 25

# Style
Style/BlockDelimiters:
  Enabled: true
  Exclude:
    - 'spec/**/*'
Style/ClassAndModuleChildren:
  Enabled: false
Style/CollectionMethods:
  Enabled: false
Style/DotPosition:
  EnforcedStyle: trailing
Style/EachWithObject:
  Enabled: false
Style/EmptyLines:
  Enabled: true
Style/EmptyLineAfterGuardClause:
  Enabled: true
Style/EmptyLineAfterMagicComment:
  Enabled: false
Style/ExtraSpacing:
  Enabled: true
Style/FrozenStringLiteralComment:
  Enabled: false
Style/FormatString:
  Enabled: false
Style/FormatStringToken:
  EnforcedStyle: annotated
Style/HashSyntax:
  Enabled: true
  Exclude:
    - 'spec/features/attaching_a_document_spec.rb'
Style/MutableConstant:
  Enabled: true
Style/NumericPredicate:
  Exclude:
    - 'spec/**/*'
Style/ParameterAlignment:
  EnforcedStyle: with_fixed_indentation
Style/PercentLiteralDelimiters:
  PreferredDelimiters:
    '%w': '[]'
    '%W': '[]'
    '%i': '[]'
Style/RegexpLiteral:
  Enabled: false
Style/StringConcatenation:
  Enabled: true
Style/StringLiterals:
  Enabled: false
Style/SymbolArray:
  EnforcedStyle: brackets
Style/TrailingCommaInHashLiteral:
  Enabled: true
Style/TrivialAccessors:
  AllowPredicates: true
Style/WordArray:
  EnforcedStyle: brackets

# Lint
Lint/AssignmentInCondition:
  AllowSafeAssignment: false
Lint/ConstantDefinitionInBlock:
  Enabled: true
Lint/EmptyFile:
  Exclude:
    - 'config/nulldb_schema.rb'
Lint/IneffectiveAccessModifier:
  Enabled: true
Lint/MissingCopEnableDirective:
  Enabled: true
Lint/UnusedMethodArgument:
  Enabled: true
Lint/UselessAccessModifier:
  Enabled: true

# Documentation
Documentation:
  Description: Document classes and non-namespace modules.
  Enabled: false

# RSpec
RSpec/DescribeClass:
  Exclude:
    - spec/support/**/*
    - spec/views/**/*
RSpec/EmptyLineAfterExampleGroup:
  Enabled: true
RSpec/EmptyLineAfterFinalLet:
  Enabled: true
RSpec/ExampleLength:
  Exclude:
    - 'spec/**/*'
RSpec/ExampleWording:
  Enabled: true
RSpec/ExpectActual:
  Exclude:
    - 'spec/routing/**/*'
RSpec/ExpectInHook:
  Enabled: true
RSpec/FilePath:
  Exclude:
    - 'spec/services/carrierwave_filename_spec.rb'
RSpec/LeakyConstantDeclaration:
  Enabled: true
RSpec/LetBeforeExamples:
  Enabled: true
RSpec/MultipleExpectations:
  Exclude:
    - 'spec/features/**/*'
RSpec/NamedSubject:
  Enabled: true
RSpec/NotToNot:
  Enabled: true
RSpec/RepeatedDescription:
  Enabled: true
RSpec/ScatteredSetup:
  Enabled: true
  Exclude:
    - "spec/features/create_claim_applications_spec.rb"
RSpec/StubbedMock:
  Enabled: true
RSpec/NestedGroups:
  Max: 10
RSpec/VerifiedDoubles:
  Exclude:
    - 'spec/forms/refunds/**/*_spec.rb'
RSpec/MessageSpies:
  EnforcedStyle: receive
RSpec/MultipleMemoizedHelpers:
  Exclude:
    - 'spec/views/claim_reviews/show/review_page_employment_spec.rb'
    - 'spec/models/stats/claim_stats_spec.rb'
    - 'spec/forms/refunds/review_form_spec.rb'
    - 'spec/forms/refunds/confirmation_form_spec.rb'
    - 'spec/forms/additional_claimants_upload_form_spec.rb'
    - 'spec/features/terms_spec.rb'
    - 'spec/features/guide_spec.rb'
    - 'spec/features/create_claim_applications_spec.rb'
    - 'spec/features/attaching_a_document_spec.rb'

# Capybara
Capybara/CurrentPathExpectation:
  Enabled: true

# Rails
Rails/Blank:
  Enabled: true
  Exclude:
    - 'app/views/api/claim/_build_primary_representative.json.jbuilder'
    - 'app/controllers/claims_controller.rb'
Rails/Date:
  Enabled: true
Rails/FilePath:
  Enabled: true
Rails/LexicallyScopedActionFilter:
  Enabled: true
  Exclude:
    - 'app/controllers/save_and_return/sessions_controller.rb'
Rails/SkipsModelValidations:
  Enabled: false
Rails/InverseOf:
  Enabled: false
Rails/HasManyOrHasOneDependent:
  Enabled: false

# Layout
Layout/AccessModifierIndentation:
  EnforcedStyle: indent
Layout/BlockAlignment:
  Enabled: true
Layout/EmptyLinesAroundBlockBody:
  Enabled: false
Layout/EmptyLinesAroundClassBody:
  Enabled: false
Layout/EmptyLinesAroundModuleBody:
  Enabled: false
Layout/EmptyLineAfterGuardClause:
  Enabled: true
Layout/EmptyLines:
  Enabled: true
Layout/ExtraSpacing:
  Enabled: true
Layout/InitialIndentation:
  Enabled: true
Layout/LeadingEmptyLines:
  Enabled: true
Layout/LineLength:
  Max: 120
  Exclude:
    - 'features/**/*'
    - 'spec/**/*'
    - 'Gemfile'
    - 'import-secrets.rb'
    - 'config/initializers/devise.rb'
    - 'config/environments/*.rb'
    - 'app/validators/ccd_phone_validator.rb'
Layout/MultilineMethodCallIndentation:
  Enabled: true
Layout/ParameterAlignment:
  EnforcedStyle: with_fixed_indentation
Layout/SpaceInsideArrayLiteralBrackets:
  Enabled: true
Layout/TrailingEmptyLines:
  Enabled: true

# Naming
Naming/FileName:
  Exclude:
    - "import-secrets.rb"
Naming/PredicateName:
  Enabled: false

require:
  - rubocop-rspec
  - rubocop-rails
  - rubocop-capybara
  - rubocop-factory_bot
  - rubocop-rspec_rails