-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
219 lines (183 loc) · 6.14 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# To make it easier to find descriptions and add exceptions
AllCops:
TargetRubyVersion: 3.1
DisabledByDefault: false
NewCops: enable
DisplayCopNames: true
Exclude:
- "bin/**/*"
- "db/schema.rb"
- "db/migrate/*"
- "node_modules/**/*"
- "tmp/**/*"
- "spec/**/*"
- "vendor/**/*"
require:
- rubocop-rspec
Style/FormatStringToken:
Enabled: false
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19
EnforcedShorthandSyntax: never # Dont use shorthand yet. Maybe one day.
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Bundler/DuplicatedGem
# Checks for duplicate gem entries in Gemfile.
Bundler/DuplicatedGem:
Enabled: true
Include:
- "**/Gemfile"
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Bundler/InsecureProtocolSource
# The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
# because HTTP requests are insecure. Please change your source to
# 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Bundler/InsecureProtocolSource:
Enabled: true
Include:
- "**/Gemfile"
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Bundler/OrderedGems
# Gems within groups in the Gemfile should be alphabetically sorted.
Bundler/OrderedGems:
Enabled: true
Include:
- "**/Gemfile"
Layout/BeginEndAlignment:
Enabled: true
EnforcedStyleAlignWith: start_of_line
Layout/EndAlignment:
Enabled: true
EnforcedStyleAlignWith: variable
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Layout/IndentHash
# To make reasonable use of whitespace
Layout/FirstHashElementIndentation:
EnforcedStyle: "consistent"
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Layout/IndentArray
# To make reasonable use of whitespace
Layout/FirstArrayElementIndentation:
EnforcedStyle: "consistent"
Layout/IndentationConsistency:
Enabled: false
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Layout/DotPosition
# So when reading code we know that given line has continuation
Layout/DotPosition:
EnforcedStyle: "trailing"
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Lint/AmbiguousBlockAssociation
# It looks perfectly fine for asserting change
Lint/AmbiguousBlockAssociation:
Exclude:
- "**/*_spec.rb"
Naming/ClassAndModuleCamelCase:
Exclude:
- "**/*_decorator.rb"
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Metrics/AbcSize
# Lets be reasonable about it
# It is common to exceed AbcSize in migrations and decorators
Metrics/AbcSize:
Enabled: false
Exclude:
- "app/decorators/**/*"
- "db/migrate/**/*"
- "lib/**/*"
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Metrics/BlockLength
# It is common to have long blocks in routes, specs, matchers,
# factories and configuration files
Metrics/BlockLength:
Exclude:
- "config/environments/*.rb"
- "config/initializers/*.rb"
- "config/routes.rb"
- "config/routes/*.rb"
- "lib/**/*.rb"
- "lib/**/*.rake"
- "spec/spec_helper.rb"
- "spec/**/*_factory.rb"
- "spec/support/matchers/*.rb"
- "**/*_spec.rb"
Layout/LineLength:
Enabled: false
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Metrics/MethodLength
# 12 does not seem too restrictive
# Long methods are common to migrations and seeds
# And also to decorator as_json(*) methods.
Metrics/MethodLength:
Max: 12
Exclude:
- "app/decorators/**/*"
- "db/migrate/**/*"
- "db/seeds/**/*"
- "lib/**/*.rb"
- "lib/**/*.rake"
# https://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Metrics/ModuleLength
# Large modules are totally fine in rspec
Metrics/ModuleLength:
Exclude:
- "**/*_spec.rb"
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/AccessorMethodName
# It is common to expose `get_` like interface in wrappers
Naming/AccessorMethodName:
Enabled: false
Exclude:
- "app/wrappers/**/*.rb"
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/VariableNumber
# More readable
Naming/VariableNumber:
EnforcedStyle: "snake_case"
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/Alias
# To keep it consistent. `alias` does not work for all cases (i.e. aliasing at runtime)
Style/Alias:
EnforcedStyle: "prefer_alias_method"
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/BlockDelimiters
# It is common to use {} blocks for `expect`
Style/BlockDelimiters:
Exclude:
- "**/*_spec.rb"
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/DateTime
# We do not care about it that much, and sometimes we need it
Style/DateTime:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/Documentation
# We prefer everything to be self-explanatory
Style/Documentation:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/ExpandPathArguments
Style/ExpandPathArguments:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FormatString
# The shortest syntax
Style/FormatString:
EnforcedStyle: "percent"
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FrozenStringLiteralComment
# We do not care
Style/FrozenStringLiteralComment:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/GuardClause
# Sometimes using explicit condition is more readable
Style/GuardClause:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/GlobalVars
# FST: Disable for now. Should be refactored later
Style/GlobalVars:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/MutableConstant
# Seriously this has never been a problem and it looks weird
Style/MutableConstant:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/NumericLiterals
# It looks awkward for custom ids
Style/NumericLiterals:
Enabled: false
Exclude:
- "**/*_spec.rb"
- "**/*_factory.rb"
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/BeginBlock
Style/BeginBlock:
Enabled: true
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/WordArray
Style/WordArray:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/SymbolArray
Style/SymbolArray:
Enabled: false
Layout/EmptyLineBetweenDefs:
Enabled: true
Style/ImplicitExpect:
EnforcedStyle: should