forked from paper-trail-gem/paper_trail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
135 lines (108 loc) · 4.15 KB
/
.rubocop.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
require:
- rubocop-rspec
inherit_from: .rubocop_todo.yml
# Please:
#
# - Comment any deviations from the Ruby Style Guide
# - Alphabetize cops
# - Only include permanent config; temporary goes in .rubocop_todo.yml
AllCops:
Exclude:
- 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: 2.1
# Migrations often contain long up/down methods, and extracting smaller methods
# from these is of questionable value.
Metrics/AbcSize:
Exclude:
- 'test/dummy/db/migrate/*'
# Not a useful metric compared to, e.g. `AbcSize`.
Metrics/BlockLength:
Enabled: false
# Not a useful metric compared to, e.g. `AbcSize`.
Metrics/ClassLength:
Enabled: false
# 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
# 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.
Metrics/MethodLength:
Enabled: false
# Not a useful metric compared to, e.g. `AbcSize`.
Metrics/ModuleLength:
Enabled: false
# In an ideal world, each example has a single expectation. In the real world,
# sometimes setup is a pain and you don't want to duplicate setup in multiple
# examples, or make the specs more confusing with many nested `context`s, and
# the practical thing is to have multiple expectations.
RSpec/MultipleExpectations:
Enabled: false
# Yes, ideally examples would be short. Is it possible to pick a limit and say,
# "no example will ever be longer than this"? Hard to say. Sometimes they're
# quite long.
RSpec/ExampleLength:
Enabled: false
Style/AlignParameters:
EnforcedStyle: with_fixed_indentation
# 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
Style/DotPosition:
EnforcedStyle: trailing
# Use double negation wherever it would otherwise be impractical to convert
# a value to an actual boolean.
Style/DoubleNegation:
Enabled: false
Style/FileName:
Exclude:
- Appraisals
# 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:
Enabled: false
# Use postfix (modifier) conditionals for one-liners, unless doing so would
# exceed 60 characters.
Style/IfUnlessModifier:
MaxLineLength: 60
Style/IndentHeredoc:
Exclude:
- paper_trail.gemspec
# 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
# 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'
Style/MultilineMethodCallIndentation:
EnforcedStyle: indented
Style/MultilineOperationIndentation:
EnforcedStyle: indented
Style/PredicateName:
NameWhitelist: has_paper_trail
# 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
# 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