paulfioravanti/resume

View on GitHub
.rubocop.yml

Summary

Maintainability
Test Coverage
# Contains personal customisations of Rubocop default rules
require:
  - rubocop-rake
  - rubocop-rspec

AllCops:
  Exclude:
    - "resume.rb"
    - "strings_en.rb"
    - "strings_it.rb"
    - "strings_ja.rb"
    # NOTE: Although this exclusion is in the default Rubocop config, it seems
    # that CI still goes looking in the vendor directory and attempts to
    # scan all files in all gems, so make the exclusion explicit here.
    - "vendor/**/*"
    - "bin/*"
  TargetRubyVersion: 3.2
  NewCops: enable

Layout/DotPosition:
  EnforcedStyle: trailing

# NOTE: This cop is only disabled due to build-related issues on Windows
# via Appveyor.
Layout/EndOfLine:
  Enabled: false

Layout/FirstArrayElementLineBreak:
  Enabled: true

Layout/FirstHashElementLineBreak:
  Enabled: true

Layout/FirstMethodArgumentLineBreak:
  Enabled: true

Layout/FirstMethodParameterLineBreak:
  Enabled: true

Layout/MultilineAssignmentLayout:
  Enabled: true
  EnforcedStyle: new_line

Layout/MultilineMethodCallIndentation:
  Exclude:
    - "spec/**/*"
    - "resume.rb"

Metrics/AbcSize:
  Max: 18

Metrics/BlockLength:
  AllowedMethods:
    - "before"
    - "configure"
    - "context"
    - "describe"
    - "new"

Metrics/MethodLength:
  Max: 16

Metrics/ModuleLength:
  Exclude:
    - "spec/**/*.rb"
    - "resume.rb"

Naming/RescuedExceptionsVariableName:
  PreferredName: error

RSpec/ExampleLength:
  # NOTE: Pretty much the fault of the FontExtractor module needing to mock
  # out the entirety of its interaction with Zip::File, as well as the
  # amount of expectations needed in the application_spec to trace the
  # application flow all the way to opening a generated resume.
  Max: 15

# NOTE: RSpec cop seems to ignore the AllCops directive and complains that
# the resume.rb file isn't a *_spec.rb file. Therefore, suppress that issue.
RSpec/FilePath:
  Exclude:
    - "resume.rb"

# NOTE: Increased maximum number of allowed expectations due to having
# expectations in before/after blocks becoming bad practice.
RSpec/MultipleExpectations:
  Max: 6

# NOTE: I have lots of tests that require more than 5 let statements in order
# to make them intelligible.
RSpec/MultipleMemoizedHelpers:
  Enabled: false

# NOTE: This deep nesting mostly due to the wide range of paths that gem
# installation and file fetching can take, and the different errors that
# can occur.
RSpec/NestedGroups:
  Max: 8

Style/CaseEquality:
  # NOTE: This is rule is disabled, but care should be made to
  # *only ever* use `===` in `case` statements.
  Enabled: false

Style/Documentation:
  Exclude:
    # NOTE: When the specs are added to the bottom of the generated one-sheet
    # resume file, there is no top-level module documentation to go with it,
    # and Rubocop seems to not be able to see that it exists earlier in the
    # file. So, exclude resume.rb from Rubocop's document gaze.
    - "resume.rb"
    # No need to repeat top-level documentation for specs.
    - "spec/**/*"

# NOTE: PDF generation requires string mutation, so this can't be used for now.
Style/FrozenStringLiteralComment:
  Enabled: false

# NOTE: I'm still on the fence about Ruby 3.1's shorthand syntax...
Style/HashSyntax:
  EnforcedShorthandSyntax: either

# NOTE: There are some places where having modifier-if just looks strange to me,
# so this rule is disabled.
Style/IfUnlessModifier:
  Enabled: false

Style/ImplicitRuntimeError:
  Enabled: true

Style/InlineComment:
  Enabled: true

Style/MethodCalledOnDoEndBlock:
  Enabled: true

Style/OptionHash:
  Enabled: true

Style/Send:
  Enabled: true

Style/StringLiterals:
  EnforcedStyle: double_quotes
  ConsistentQuotesInMultiline: true

Style/StringMethods:
  Enabled: true

Style/SymbolArray:
  Enabled: true