2015-11-27 21:16:37 -05:00
|
|
|
inherit_from: .rubocop_todo.yml
|
|
|
|
|
2016-02-15 18:13:45 -05:00
|
|
|
# Please:
|
|
|
|
#
|
|
|
|
# - Comment any deviations from the Ruby Style Guide
|
|
|
|
# - Alphabetize cops
|
|
|
|
# - Only include permanent config; temporary goes in .rubocop_todo.yml
|
|
|
|
|
2015-11-01 21:33:16 -05:00
|
|
|
AllCops:
|
|
|
|
Exclude:
|
2016-08-09 00:09:15 -04:00
|
|
|
- gemfiles/vendor/bundle/**/* # This dir only shows up on travis ¯\_(ツ)_/¯
|
|
|
|
- test/dummy/db/schema.rb # Generated, out of our control
|
|
|
|
|
|
|
|
# Set to lowest supported version
|
|
|
|
TargetRubyVersion: 1.9
|
2016-02-15 18:13:45 -05:00
|
|
|
|
2016-03-31 04:53:02 -04:00
|
|
|
# Migrations often contain long up/down methods, and extracting smaller methods
|
|
|
|
# from these is of questionable value.
|
|
|
|
Metrics/AbcSize:
|
|
|
|
Exclude:
|
|
|
|
- 'test/dummy/db/migrate/*'
|
|
|
|
|
2016-11-11 15:28:21 -05:00
|
|
|
# Not a useful metric compared to, e.g. `AbcSize`.
|
|
|
|
Metrics/ClassLength:
|
|
|
|
Enabled: false
|
|
|
|
|
2016-02-15 18:13:45 -05:00
|
|
|
# The Ruby Style Guide recommends to "Limit lines to 80 characters."
|
|
|
|
# (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
|
|
|
|
# but 100 is also reasonable.
|
|
|
|
Metrics/LineLength:
|
|
|
|
Max: 100
|
|
|
|
|
2016-04-01 12:33:22 -04:00
|
|
|
# The number of lines in a method is not a useful metric compared to `AbcSize`.
|
|
|
|
# It's common to have very long methods (> 50 lines) which are quite simple. For
|
|
|
|
# example, a method that returns a long string with only a few interpolations.
|
2016-02-15 18:13:45 -05:00
|
|
|
Metrics/MethodLength:
|
2016-04-01 12:33:22 -04:00
|
|
|
Enabled: false
|
2015-11-27 23:37:29 -05:00
|
|
|
|
2016-11-11 15:28:21 -05:00
|
|
|
# Not a useful metric compared to, e.g. `AbcSize`.
|
|
|
|
Metrics/ModuleLength:
|
|
|
|
Enabled: false
|
|
|
|
|
2015-11-27 23:37:29 -05:00
|
|
|
Style/AlignParameters:
|
|
|
|
EnforcedStyle: with_fixed_indentation
|
|
|
|
|
2016-01-18 14:27:07 -05:00
|
|
|
# Please use semantic style, e.g. `do` when there's a side-effect, else `{}`.
|
|
|
|
# The semantic style is too nuanced to lint, so the cop is disabled.
|
|
|
|
Style/BlockDelimiters:
|
|
|
|
Enabled: false
|
|
|
|
|
2015-11-27 23:37:29 -05:00
|
|
|
Style/DotPosition:
|
|
|
|
EnforcedStyle: trailing
|
|
|
|
|
2016-02-21 23:06:16 -05:00
|
|
|
# Use double negation wherever it would otherwise be impractical to convert
|
|
|
|
# a value to an actual boolean.
|
|
|
|
Style/DoubleNegation:
|
|
|
|
Enabled: false
|
|
|
|
|
2016-03-13 19:23:15 -04:00
|
|
|
# The decision of when to use a guard clause to improve readability is subtle,
|
|
|
|
# and it's not clear that it can be linted. Certainly, the default
|
|
|
|
# `MinBodyLength` of 1 can actually hurt readability.
|
|
|
|
Style/GuardClause:
|
|
|
|
MinBodyLength: 3
|
|
|
|
|
2016-04-09 00:08:51 -04:00
|
|
|
# Use postfix (modifier) conditionals for one-liners, unless doing so would
|
|
|
|
# exceed 60 characters.
|
|
|
|
Style/IfUnlessModifier:
|
|
|
|
MaxLineLength: 60
|
|
|
|
|
2015-11-27 23:37:29 -05:00
|
|
|
# The Ruby Style Guide says:
|
|
|
|
#
|
|
|
|
# > Use \ instead of + or << to concatenate two string literals at line end.
|
|
|
|
#
|
|
|
|
# but in my experience the `\` style is rarely used and less readable. Please
|
|
|
|
# concatenate multiline strings with `+` or use a HEREDOC.
|
|
|
|
Style/LineEndConcatenation:
|
|
|
|
Enabled: false
|
2016-03-05 17:07:32 -05:00
|
|
|
|
2016-04-08 18:14:42 -04:00
|
|
|
# Using `module_function` instead of `extend self` would make the instance
|
|
|
|
# methods in these modules private. That would be a breaking change, so these
|
|
|
|
# modules are excluded. See discussion in:
|
|
|
|
# - https://github.com/airblade/paper_trail/pull/756
|
|
|
|
# - https://github.com/bbatsov/ruby-style-guide/issues/556
|
|
|
|
Style/ModuleFunction:
|
|
|
|
Exclude:
|
|
|
|
- 'lib/paper_trail/serializers/json.rb'
|
|
|
|
- 'lib/paper_trail/serializers/yaml.rb'
|
|
|
|
|
2016-03-05 17:30:53 -05:00
|
|
|
Style/MultilineMethodCallIndentation:
|
|
|
|
EnforcedStyle: indented
|
|
|
|
|
|
|
|
Style/MultilineOperationIndentation:
|
|
|
|
EnforcedStyle: indented
|
|
|
|
|
2016-03-05 17:21:36 -05:00
|
|
|
Style/PredicateName:
|
|
|
|
NameWhitelist: has_paper_trail
|
|
|
|
|
2016-03-05 17:07:32 -05:00
|
|
|
# The Ruby Style Guide does not prescribe a particular quote character, only
|
|
|
|
# that a project should pick one and be consistent. The decision has no
|
|
|
|
# performance implications. Double quotes are slightly easier to read.
|
|
|
|
Style/StringLiterals:
|
|
|
|
EnforcedStyle: double_quotes
|
2016-04-09 00:31:44 -04:00
|
|
|
|
|
|
|
# Use exactly one space on each side of an operator. Do not align operators
|
|
|
|
# because it makes the code harder to edit, and makes lines unnecessarily long.
|
|
|
|
Style/SpaceAroundOperators:
|
|
|
|
AllowForAlignment: false
|