dkniffin/kinship

View on GitHub
.rubocop.yml

Summary

Maintainability
Test Coverage
require:
  - rubocop-rspec
  - rubocop-performance
  - rubocop-rails

AllCops:
  Exclude:
    # Reason: This file is machine-generated and can't be linted
    - db/schema.rb
    # Reason: Migrations are one-off tasks that are very different than the rest of code
    - db/migrate/*
    # Reason: They're bin files. They're very different from normal code
    - bin/*
    - lib/files/cucumber.rake
    # Reason: They fall outside our normal pattern of code
    - lib/tasks/*
    # Reason: They're typically installed by gems and not something we deal with often
    - config/initializers/*
    - Vagrantfile
    - Rakefile
    # Reason: They're tempfiles, who cares?
    - tmp/*
    # Reason: Node modules isn't ruby code
    - node_modules/**/*
    - vendor/bundle/**/*
  UseCache: false
  NewCops: enable

# ==================== Layout ====================

# Reason: Annoying and unvaluable
Layout/TrailingEmptyLines:
  Enabled: false

# Reason: 80 is very short, especially on wide-screen monitors
Layout/LineLength:
  Max: 100
  # Ignore lines that are just really long comments. Mostly generated by gems
  IgnoredPatterns: ['\A\s*#']

# ==================== Metrics ====================

# Reason: Too difficult to resolve
Metrics/AbcSize:
  Enabled: false

# Reason: Too difficult to resolve
Metrics/BlockLength:
  Enabled: false

# Reason: Too difficult to resolve
Metrics/ClassLength:
  Enabled: false

# Reason: Too difficult to resolve
Metrics/ModuleLength:
  Enabled: false

# Reason: Too difficult to resolve
Metrics/CyclomaticComplexity:
  Enabled: false

# Reason: Too difficult to resolve
Metrics/MethodLength:
  Enabled: false

# Reason: Too difficult to resolve
Metrics/ParameterLists:
  Enabled: false

# Reason: Too difficult to resolve
Metrics/PerceivedComplexity:
  Enabled: false

# ==================== Style ====================

# Reason: In some cases, `if !` reads better than `unless`
Style/IfUnlessModifier:
  Enabled: false

# Reason: https://anti-pattern.com/always-use-double-quoted-strings-in-ruby
Style/StringLiterals:
  EnforcedStyle: double_quotes

# Reason: https://anti-pattern.com/always-use-double-quoted-strings-in-ruby
Style/StringLiteralsInInterpolation:
  EnforcedStyle: double_quotes

# Reason: Team preference.
Style/ClassAndModuleChildren:
  Enabled: false

# Reason: https://blog.bigbinary.com/2012/01/08/alias-vs-alias-method.html
Style/Alias:
  EnforcedStyle: prefer_alias_method

# Reason: This documentation is often tedious to write, and not always useful
Style/Documentation:
  Enabled: false

# Reason: Sometimes it makes sense to use each
# https://blog.arkency.com/inject-vs-each-with-object/
Style/EachWithObject:
  Enabled: false

# Reason: Team preference? (not really sure on this one)
Style/ModuleFunction:
  Enabled: false

# Reason: // syntax is more common for single-line, but harder to read for multi-line
Style/RegexpLiteral:
  EnforcedStyle: mixed

# Reason: Team preference
Style/WhenThen:
  Enabled: false

# Reason: Team preference
Style/FormatStringToken:
  EnforcedStyle: template

# Reason: Adding underscores to numbers doesn't always make sense. Eg: Time integers
Style/NumericLiterals:
  Enabled: false

# Reason: Multiline lambdas still read fine with the arrow syntax
Style/Lambda:
  Enabled: false

# ==================== Rails ====================

# Reason: We do rails
Rails:
  Enabled: true

# Reason: Added staging
Rails/UnknownEnv:
  Environments:
    - production
    - staging
    - development
    - test
    - qa
    - demo

# ==================== RSpec ====================

RSpec/DescribeClass:
  Exclude:
    - spec/tasks/*
    - spec/seeds/*
    - spec/system/*
    - spec/graphql/schema_spec.rb

# Reason: Too hard to enforce in some cases
RSpec/MultipleExpectations:
  Enabled: false

# Reason: Too hard to enforce in some cases
RSpec/ExampleLength:
  Enabled: false

# Reason: Requiring a spy is sometimes unnecessary
RSpec/MessageSpies:
  Enabled: false

# Reason: Add a `before` for this is unnecessary
RSpec/LetSetup:
  Enabled: false

# Reason: The default max depth of 3 is too strict
RSpec/NestedGroups:
  Max: 5

# Reason: Using `subject` explicitly makes it clear what's being tested
RSpec/NamedSubject:
  Enabled: false

# Reason: Team preference
RSpec/NotToNot:
  EnforcedStyle: to_not