publify/publify

View on GitHub
.rubocop.yml

Summary

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

AllCops:
  Exclude:
  - 'bin/*'
  - 'tmp/**/*'
  - 'publify_core/bin/*'
  - 'publify_core/spec/dummy/bin/*'
  - 'publify_core/spec/dummy/db/schema.rb'
  - 'publify_amazon_sidebar/bin/*'
  - 'publify_amazon_sidebar/spec/dummy/bin/*'
  - 'publify_amazon_sidebar/spec/dummy/db/schema.rb'
  - 'publify_textfilter_code/bin/*'
  - 'publify_textfilter_code/spec/dummy/bin/*'
  - 'publify_textfilter_code/spec/dummy/db/schema.rb'
  - 'db/converters/*.rb'
  - 'db/scripts/fix_permalinks.rb'
  - 'db/schema.rb'
  - 'vendor/bundle/**/*'
  NewCops: enable
  TargetRubyVersion: 2.4

Rails:
  Enabled: true

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

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

# 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

# The tasks to run subrepo tasks, and the i18n health check do not need environment
Rails/RakeEnvironment:
  Exclude:
    - 'lib/tasks/rspec.rake'
    - 'lib/tasks/manifests.rake'
    - 'lib/tasks/i18n.rake'

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

# 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

inherit_from: .rubocop_todo.yml