-
Notifications
You must be signed in to change notification settings - Fork 6
/
.rubocop-enforced.yml
274 lines (218 loc) · 7.94 KB
/
.rubocop-enforced.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# Things added to this file are enforced by CI
require:
- rubocop-rails
AllCops:
DisabledByDefault: true
Include:
- '**/*.rb'
- '**/*.rake'
- '**/config.ru'
- '**/Gemfile'
- '**/Rakefile'
################# Layout #################
Layout/DefEndAlignment:
Description: 'Align ends corresponding to defs correctly.'
EnforcedStyleAlignWith: start_of_line
Enabled: true
Layout/EmptyLines:
Description: "This cop checks for two or more consecutive blank lines."
StyleGuide: "https://github.com/rubocop-hq/ruby-style-guide#two-or-more-empty-lines"
Enabled: true
Layout/EmptyLineBetweenDefs:
Description: 'Use empty lines between defs.'
# EmptyLineBetweenClassDefs disabled for now to preserve old behaviour
# added in 1.4.0 https://github.com/rubocop/rubocop/releases/tag/v1.4.0
EmptyLineBetweenClassDefs: false
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods'
Enabled: true
Layout/EndOfLine:
Description: 'Use Unix-style line endings.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf'
Enabled: true
Layout/ExtraSpacing:
AllowForAlignment: true
Description: 'Do not use unnecessary spacing.'
Enabled: true
Layout/HeredocIndentation:
Description: >-
This cops checks the indentation of the here document bodies.
The bodies are indented one step. In Ruby 2.3 or newer, squiggly heredocs (<<~) should be used.
Enabled: true
Layout/SpaceAfterMethodName:
Description: >-
Do not put a space between a method name and the opening
parenthesis in a method definition.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
Enabled: true
Layout/SpaceAroundKeyword:
Description: 'Use a space around keywords if appropriate.'
Enabled: true
Layout/SpaceAroundOperators:
Description: 'Use a single space around operators.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
Enabled: true
Layout/SpaceBeforeBlockBraces:
Description: >-
Checks that the left block brace has or doesn't have space
before it.
Enabled: true
Exclude:
- "**/spec/**/*.rb"
Layout/SpaceBeforeComma:
Description: 'No spaces before commas.'
Enabled: true
Layout/SpaceInsideHashLiteralBraces:
Description: "Use spaces inside hash literal braces - or don't."
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
Enabled: true
Layout/TrailingEmptyLines:
# See also: https://robots.thoughtbot.com/no-newline-at-end-of-file
Description: 'Checks trailing blank lines and final newline.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
Enabled: true
Layout/TrailingWhitespace:
Enabled: true
################# Lint #######################
Lint/CircularArgumentReference:
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
Enabled: true
Lint/Debugger:
Description: 'Check for debugger calls.'
Enabled: true
Lint/DeprecatedClassMethods:
Enabled: true
Lint/DuplicateHashKey:
Description: 'Check for duplicate keys in hash literals.'
Enabled: true
Lint/EnsureReturn:
Enabled: true
Lint/InheritException:
Enabled: true
Lint/NestedMethodDefinition:
Description: 'Do not use nested method definitions.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
Enabled: true
Lint/RescueException:
Enabled: true
Lint/RedundantStringCoercion:
Enabled: true
Lint/UnreachableCode:
Enabled: true
Lint/UnusedBlockArgument:
Description: 'Checks for unused block arguments.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
Enabled: true
################# Naming #######################
Naming/AsciiIdentifiers:
Description: 'Use only ascii symbols in identifiers.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
Enabled: true
Naming/ClassAndModuleCamelCase:
Description: 'Use CamelCase for classes and modules.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#camelcase-classes'
Enabled: true
Naming/ConstantName:
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#screaming-snake-case'
Enabled: true
Naming/FileName:
Description: 'Use snake_case for source file names.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
Enabled: true
################# Style #######################
Style/ArrayJoin:
Description: 'Use Array#join instead of Array#*.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
Enabled: true
Style/BeginBlock:
Description: 'Avoid the use of BEGIN blocks.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks'
Enabled: true
Style/BlockComments:
Description: 'Do not use block comments.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
Enabled: true
Style/BlockDelimiters:
Description: >-
Avoid using {...} for multi-line blocks (multiline chaining is
always ugly).
Prefer {...} over do...end for single-line blocks.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
Enabled: true
Style/EndBlock:
Description: 'Avoid the use of END blocks.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-END-blocks'
Enabled: true
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19_no_mixed_keys
Exclude:
Style/IfUnlessModifierOfIfUnless:
Description: >-
Avoid modifier if/unless usage on conditionals.
Enabled: true
Style/IfWithSemicolon:
Description: 'Do not use if x; .... Use the ternary operator instead.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
Enabled: true
Style/MethodCallWithoutArgsParentheses:
Description: 'Do not use parentheses for method calls with no arguments.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
Enabled: true
Style/MissingRespondToMissing:
Enabled: true
Style/RaiseArgs:
Description: 'Checks the arguments passed to raise/fail.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
EnforcedStyle: compact
Enabled: false
Style/RedundantReturn:
Description: "Don't use return where it's not required."
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-return'
Enabled: true
Style/Semicolon:
Description: "Don't use semicolons to terminate expressions."
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon'
Enabled: true
Style/SpecialGlobalVars:
Description: 'Avoid Perl-style global variables.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
Enabled: true
Style/StringLiterals:
EnforcedStyle: double_quotes
Description: 'Prefer double-quotes unless your string literal contains " or escape characters you want to suppress.'
Enabled: true
################# Rails Cops ##########################
Rails/DynamicFindBy:
Description: "Favor the use of find_by over where.take and find_by_attribute when you need to retrieve a single record by one or more attributes and return nil when the record is not found"
Enabled: true
Rails/EnumHash:
Description: "This cop looks for enums written with array syntax."
Enabled: true
Rails/HttpPositionalArguments:
Enabled: true
Rails/ActiveRecordAliases:
Enabled: true
################# Security ####################
Rails/OutputSafety:
Description: 'The use of `html_safe` or `raw` may be a security risk.'
Enabled: true
Exclude:
- "**/spec/**/*.rb"
Security/Eval:
Description: 'The use of eval represents a serious security risk.'
Enabled: true
Security/JSONLoad:
Enabled: true
Exclude:
- "**/spec/**/*.rb"
- "script/**/*.rb"
Security/MarshalLoad:
Enabled: true
Security/Open:
Enabled: true
Security/YAMLLoad:
Enabled: true
Exclude:
- "**/spec/**/*.rb"
- "script/*"