.rubocop.yml
AllCops:
TargetRubyVersion: 2.3
Include:
- 'Gemfile'
- 'Rakefile'
- 'lib/tasks/*'
- "**/*.rake"
- "**/Capfile"
- "**/Guardfile"
- "**/Vagrantfile"
- "**/Berksfile"
- "**/Cheffile"
Exclude:
- 'db/schema.rb'
- 'db/migrate/*'
- 'lib/tasks/cucumber.rake'
Lint/ParenthesesAsGroupedExpression:
Description: Checks for method calls with a space before the opening parenthesis.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-no-spaces
Enabled: true
Metrics/ClassLength:
Description: Avoid classes longer than 150 lines of code.
Enabled: true
CountComments: false
Max: 150
Metrics/AbcSize:
# The ABC size is a calculated magnitude, so this number can be a Fixnum or
# a Float.
Max: 15
Enabled: false
Metrics/LineLength:
Description: Limit lines to 120 characters.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits
Enabled: true
Max: 120
AllowURI: true
URISchemes:
- http
- https
Metrics/MethodLength:
Description: Avoid methods longer than 20 lines of code.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
Enabled: true
CountComments: false
Max: 20
Metrics/ModuleLength:
Description: Avoid modules longer than 100 lines of code.
Enabled: true
CountComments: false
Max: 100
Rails/HasAndBelongsToMany:
Description: Prefer has_many :through to has_and_belongs_to_many.
Enabled: true
Include:
- app/models/**/*.rb
Rails/ScopeArgs:
Description: Checks the arguments of ActiveRecord scopes.
Enabled: true
Include:
- app/models/**/*.rb
Rails/TimeZone:
# The value `always` means that `Time` should be used with `zone`.
# The value `acceptable` allows usage of `in_time_zone` instead of `zone`.
Enabled: true
EnforcedStyle: strict
SupportedStyles:
- strict
- flexible
Style/FrozenStringLiteralComment:
Description: >-
Add the frozen_string_literal comment to the top of files
to help transition from Ruby 2.3.0 to Ruby 3.0.
Enabled: false
Style/MultilineBlockLayout:
Description: 'Ensures newlines after multiline block do statements.'
Enabled: false
Style/ClassAndModuleChildren:
EnforcedStyle: compact
Style/AndOr:
Description: Use &&/|| instead of and/or.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-and-or-or
Enabled: true
EnforcedStyle: conditionals
SupportedStyles:
- always
- conditionals
Style/Documentation:
Description: Document classes and non-namespace modules.
Enabled: false
Style/DotPosition:
Description: Checks the position of the dot in multi-line method calls.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
Enabled: true
EnforcedStyle: leading
SupportedStyles:
- leading
- trailing
Style/IfUnlessModifier:
MaxLineLength: 80
Enabled: false
Style/NumericLiterals:
Enabled: false
Style/SignalException:
EnforcedStyle: semantic
SupportedStyles:
- only_raise
- only_fail
- semantic
Style/ExtraSpacing:
Description: Do not use unnecessary spacing.
Enabled: true
Style/TrailingWhitespace:
Description: 'Avoid trailing whitespace.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace'
Enabled: true
Style/GuardClause:
Description: Check for conditionals that can be replaced with guard clauses
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
Enabled: false
MinBodyLength: 1
Style/StringLiterals:
Description: Checks if uses of quotes match the configured preference.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
Enabled: false
EnforcedStyle: single_quotes
SupportedStyles:
- single_quotes
- double_quotes
Style/SpaceBeforeBlockBraces:
EnforcedStyle: space
SupportedStyles:
- space
- no_space
Style/SpaceInsideBlockBraces:
EnforcedStyle: space
SupportedStyles:
- space
- no_space
# Valid values are: space, no_space
EnforcedStyleForEmptyBraces: no_space
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
SpaceBeforeBlockParameters: true
Style/SpaceInsideHashLiteralBraces:
EnforcedStyle: space
EnforcedStyleForEmptyBraces: space
SupportedStyles:
- space
- no_space
Style/SpaceInsideStringInterpolation:
EnforcedStyle: no_space
SupportedStyles:
- space
- no_space
Style/StructInheritance:
Enabled: false