-
Notifications
You must be signed in to change notification settings - Fork 56
/
.rubocop.yml
140 lines (110 loc) · 3.97 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
136
137
138
139
140
# We upgrade to new versions of rubocop manually so it won't harm to enable all
# new cops.
AllCops:
TargetRubyVersion: 2.5
NewCops: enable
SuggestExtensions: false
Style/ArgumentsForwarding:
Enabled: false
# We don't want to be switching between styles depending on whether
# we're interpolating or not.
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/SymbolArray:
EnforcedStyle: brackets
# Block chains allow processing to be broken down into discrete steps
# similarly to Elixir pipelines. They actually increase readability so
# forbidding them isn't a good idea.
Style/MultilineBlockChain:
Enabled: false
# For consistency across all method definitions.
Style/EmptyMethod:
EnforcedStyle: expanded
Style/WordArray:
EnforcedStyle: brackets
Style/IfUnlessModifier:
Enabled: false
Style/SymbolProc:
Enabled: false
# Allow explicit nil else clauses.
Style/EmptyCaseCondition:
Enabled: false
Style/EmptyElse:
Enabled: false
# if !predicate is often more readable than unless predicate.
Style/NegatedIf:
Enabled: false
# We allow the old key-value syntax (key => value) in Rakefiles as that's how
# we define task dependencies.
Style/HashSyntax:
Exclude:
- lib/active_record_doctor/rake/task.rb
- '**/*.rake'
# We support older Rubies where those begins are required.
Style/RedundantBegin:
Enabled: false
# We expect #raise to receive an instance of the exception to raise instead of
# passing in a message as the second parameter. That's because we'd like to be
# able to pass arbitrary parameters to the exception being raised for later
# inspection and processing.
Style/RaiseArgs:
EnforcedStyle: compact
# There's a tremendous difference between warn and $stderr.puts. We use the
# latter to report some exceptions in a user-friendly manner and don't want to
# mix them up with warnings.
Style/StderrPuts:
Enabled: false
# We pass an empty block in a few places to have a placeholder to add code to
# in the future without having to dig through the code to determine whether a
# block is allowed. Additionally, removing an empty block is **NOT** a
# refactoring because the method can change it's behavior via #block_given?.
Lint/EmptyBlock:
Enabled: false
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
# <<~ is unsupported on ancient Rubies.
Layout/HeredocIndentation:
Enabled: false
# Method length is a poor metric for quality as being forced to break a method
# up into multiple smaller pieces can increase cognitive overhead, cause
# confusion (are those smaller methods used anywhere else), add more
# meaningless identifiers.
Metrics/MethodLength:
Enabled: false
# ABC, cycolmatic complexity and perceived complexity fare rather poorly on our
# detector definitions as trying to satisfy them would mean breaking longish but
# not cognitively demanding method definitions into multiple smaller methods
# which would obscure what's going on by adding lots of indirection.
Metrics/AbcSize:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Metrics/ClassLength:
Enabled: false
# We know how to decide whether a block is too long or not.
Metrics/BlockLength:
Enabled: false
# In general, it's a good recommendation but there are two exceptions in
# active_record_doctor where it harms readability. has_presence_validator?
# is more intention revealing than presence_validator? Does the former take
# a model as a parameter and check whether it has a presence validator? Or does
# it take a validator and check its type?
Naming/PredicateName:
AllowedMethods:
- "has_presence_validator?"
- "has_mandatory_presence_validator?"
Gemspec/DevelopmentDependencies:
EnforcedStyle: gemspec
# We support a broad range of versions and it's impossible to satisfy this.
Gemspec/RequiredRubyVersion:
Enabled: false
Naming/MethodParameterName:
AllowedNames:
- as
- io
Metrics/ParameterLists:
CountKeywordArgs: false