-
Notifications
You must be signed in to change notification settings - Fork 2
/
.rubocop.yml
203 lines (170 loc) · 4.17 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
inherit_from: .rubocop_todo.yml
require:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
AllCops:
TargetRubyVersion: 2.6
DefaultFormatter: fuubar
Exclude:
- 'node_modules/**/*'
- 'vendor/**/*'
- 'db/schema.rb'
- 'bin/*'
- 'Gemfile'
- 'Gemfile.lock'
- 'db/migrate/201*'
DisplayCopNames: true
NewCops: enable
CacheRootDirectory: tmp # ie. tmp/rubocop_cache
UseCache: true
# Don't like this, it's too annoying
Layout/LineLength:
Max: 120
Enabled: false
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Lint/EmptyWhen:
Enabled: false
# This one seems mostly ok - I use empty when on purpose a lot
Lint/AmbiguousBlockAssociation:
Enabled: true
Exclude:
- "spec/**/*" # https://github.com/rubocop/rubocop/issues/4222
Metrics/AbcSize:
Enabled: false
# I don't think this is something we want to enforce (yet?)
Metrics/BlockLength:
AllowedMethods:
- "included" # concerns
- "no_commands" # thor
- "create_table" # migrations
Exclude:
- "spec/**/*.rb"
- "lib/tasks/**/*.rake"
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
# No (not yet)
Metrics/PerceivedComplexity:
Enabled: false
Naming/AccessorMethodName:
Enabled: false
# In theory this is good. In practice lots of false errors
Performance/Count:
Enabled: false
# unfixed autocorrect issue https://github.com/bbatsov/rubocop/issues/2809
# not compatible with ActiveRecord
Performance/Detect:
Enabled: false
# not compatible with ActiveRecord
# I'm not very keen on this one
Performance/TimesMap:
Enabled: false
# not now
Rails/I18nLocaleTexts:
Enabled: false
Rails/Output:
Exclude:
- config/environments/* # logger not yet set up
Rails/UnknownEnv:
Environments:
- production
- staging
- development
- test
# I can't see the value of this
RSpec/DescribeClass:
Enabled: false
RSpec/ExpectChange:
EnforcedStyle: block
# I think it is sometimes useful to use let! instead of before
RSpec/LetSetup:
Enabled: false
# I can't see the value of this
RSpec/MultipleMemoizedHelpers:
Enabled: false
Style/BlockDelimiters:
Enabled: false
EnforcedStyle: semantic
ProceduralMethods:
# Methods that are known to be procedural in nature but look functional from
# their usage, e.g.
#
# time = Benchmark.realtime do
# foo.bar
# end
#
# Here, the return value of the block is discarded but the return value of
# `Benchmark.realtime` is used.
- benchmark
- bm
- bmbm
- create
- each_with_object
- measure
- new
- realtime
- tap
- with_object
FunctionalMethods:
# Methods that are known to be functional in nature but look procedural from
# their usage, e.g.
#
# let(:foo) { Foo.new }
#
# Here, the return value of `Foo.new` is used to define a `foo` helper but
# doesn't appear to be used from the return value of `let`.
- let
- let!
- subject
- watch
- expect
AllowedMethods:
# Methods that can be either procedural or functional and cannot be
# categorised from their usage alone, e.g.
#
# foo = lambda do |x|
# puts "Hello, #{x}"
# end
#
# foo = lambda do |x|
# x * 100
# end
#
# Here, it is impossible to tell from the return value of `lambda` whether
# the inner block's return value is significant.
- lambda
- proc
- it
- html # format.html
- json # format.json
- before
Style/Documentation:
Enabled: false
# Sounds good, but really?
Style/DoubleNegation:
Enabled: false
# double negation is an ok way to enforce true / false when assigning
Style/Encoding:
Exclude:
- 'lib/tasks/*.thor' # https://github.com/rails/thor/issues/776
Style/FetchEnvVar:
Enabled:
false
Style/FormatString:
EnforcedStyle: percent
Style/HashSyntax:
EnforcedStyle: ruby19
Style/NumericLiterals:
Enabled: false
# This is a pain, most long numeric literals are things like ids or times as numbers
Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
Style/SymbolProc:
Enabled: true
AllowMethodsWithArguments: true