publify/publify

View on GitHub
.rubocop.yml

Summary

Maintainability
Test Coverage
inherit_from: .rubocop_todo.yml

inherit_mode:
  merge:
    - Exclude

require:
  - rubocop-capybara
  - rubocop-performance
  - rubocop-rails
  - rubocop-rspec

AllCops:
  Exclude:
    - 'bin/*'
    - 'db/converters/*.rb'
    - 'db/schema.rb'
  NewCops: enable
  TargetRubyVersion: 3.0

Rails:
  Enabled: true

# We have duplication due to extra logic in the Gemfile
Bundler/DuplicatedGem:
  Enabled: false

# Doesn't work well yet
Capybara/ClickLinkOrButtonStyle:
  Enabled: false

# Restore old default
Capybara/NegationMatcher:
  EnforcedStyle: not_to

Layout/BeginEndAlignment:
  EnforcedStyleAlignWith: begin

# Place . on the previous line
Layout/DotPosition:
  EnforcedStyle: trailing

# Spaces in strings with line continuations go at the beginning of the line.
Layout/LineContinuationLeadingSpace:
  EnforcedStyle: leading

# Lenient line length that fits in pull requests
Layout/LineLength:
  Max: 92

Layout/MultilineMethodCallBraceLayout:
  EnforcedStyle: same_line

# Multi-line operations should be simply indented. Aligning them makes it even
# harder to keep a sane line length.
Layout/MultilineMethodCallIndentation:
  EnforcedStyle: indented

# Multi-line operations should be simply indented. Aligning them makes it even
# harder to keep a sane line length.
Layout/MultilineOperationIndentation:
  EnforcedStyle: indented

# Uniform block layout
Layout/SpaceBeforeBlockBraces:
  EnforcedStyleForEmptyBraces: space

# Assume the programmer knows how bracketed block syntax works
Lint/AmbiguousBlockAssociation:
  Enabled: false

# Allow if (foo = get_foo) style
Lint/AssignmentInCondition:
  AllowSafeAssignment: true

# Suppress BlockLength for some files:
# - Spec describe blocks can be any length
# - Routes blocks can be any length
# - FactoryBot factory blocks can be any length
# - Gem specification blocks can be any length
Metrics/BlockLength:
  Exclude:
    - 'spec/**/*'
    - '**/*.gemspec'

# Initial schema has a very large change method
Metrics/MethodLength:
  Exclude:
    - 'db/migrate/113_initial_schema.publify_core_engine.rb'

Performance/StartWith:
  AutoCorrect: true

Performance/EndWith:
  AutoCorrect: true

# Migrations should not use ApplicationRecord
Rails/ApplicationRecord:
  Exclude:
    - 'db/migrate/*'

# This cop has issues and is too database-specific
Rails/BulkChangeTable:
  Enabled: false

# These tasks do not need environment
Rails/RakeEnvironment:
  Exclude:
    - 'lib/tasks/i18n.rake'
    - 'lib/tasks/manifests.rake'
    - 'lib/tasks/rspec.rake'
    - 'lib/tasks/rubocop.rake'

# Migrations should not do validations in general?
Rails/SkipsModelValidations:
  Exclude:
    - 'db/migrate/*'

RSpec/Capybara/FeatureMethods:
  Exclude:
    - 'spec/features/**_spec.rb'

# Spec type inference is disabled, so this cop must be disabled too.
RSpec/Rails/InferredSpecType:
  Enabled: false

# Allow the use of 'and' 'or' in control structures.
Style/AndOr:
  EnforcedStyle: conditionals

Style/ClassAndModuleChildren:
  Enabled: false

Style/CollectionMethods:
  Enabled: true

# Documenting all classes is not common in Rails projects.
Style/Documentation:
  Enabled: false

# This cop doesn't detect use of break yet
Style/EachWithObject:
  Enabled: false

# Allows format strings with: format, sprintf or percent.
Style/FormatString:
  Enabled: false

# Require at least two dependent lines before suggesting a guard clause
Style/GuardClause:
  MinBodyLength: 2

# TODO: Re-enable?
Style/NumericPredicate:
  Enabled: false

# Not all objects that implement #size implement #empty?
Style/ZeroLengthPredicate:
  Enabled: false

# Restore previous RuboCop defaults
Style/PercentLiteralDelimiters:
  PreferredDelimiters:
    '%W': ()
    '%w': ()

# Always use raise to raise exceptions
Style/SignalException:
  EnforcedStyle: only_raise

# Allow meaningful names for single-line reduce etc.
Style/SingleLineBlockParams:
  Enabled: false

# Prefer not to commit to need to interpolate
Style/StringLiterals:
  EnforcedStyle: double_quotes

# Be consistent with non-interpolated strings
Style/StringLiteralsInInterpolation:
  EnforcedStyle: double_quotes

# Prefer symbols to look like symbols
Style/SymbolArray:
  EnforcedStyle: brackets

# Prefer consistent lines for multi-line arrays
Style/TrailingCommaInArrayLiteral:
  EnforcedStyleForMultiline: comma

# Prefer consistent lines for multi-line hashes
Style/TrailingCommaInHashLiteral:
  EnforcedStyleForMultiline: comma

# Allow small arrays of words with quotes
Style/WordArray:
  MinSize: 4