-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.rubocop.yml
239 lines (184 loc) · 5.49 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
require:
- rubocop-performance
- rubocop-rails
AllCops:
DisabledByDefault: true
TargetRubyVersion: 2.6.5
Exclude:
- Gemfile
- node_modules/**/*
- bin/*
- config/**/*
- 'script/**/*'
- 'vendor/**/*'
- 'public/**/*'
# layout (https://docs.rubocop.org/rubocop/cops_layout.html)
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
# Align `when` with `case`.
Layout/CaseIndentation:
Enabled: true
# Align comments with method definitions.
Layout/CommentIndentation:
Enabled: true
Layout/ElseAlignment:
Enabled: true
# Align `end` with the matching keyword or starting expression except for
# assignments, where it should be aligned with the LHS.
Layout/EndAlignment:
Enabled: true
EnforcedStyleAlignWith: variable
AutoCorrect: true
Layout/EmptyLineAfterMagicComment:
Enabled: true
Layout/EmptyLinesAroundAccessModifier:
Enabled: true
EnforcedStyle: only_before
Layout/EmptyLinesAroundBlockBody:
Enabled: true
# In a regular class definition, no empty lines around the body.
Layout/EmptyLinesAroundClassBody:
Enabled: true
# In a regular method definition, no empty lines around the body.
Layout/EmptyLinesAroundMethodBody:
Enabled: true
# In a regular module definition, no empty lines around the body.
Layout/EmptyLinesAroundModuleBody:
Enabled: true
# This cop checks if empty lines exist around the bodies of begin-end blocks.
Layout/EmptyLinesAroundModuleBody:
Enabled: true
# Keep lines shorter than 128 characters.
Layout/LineLength:
Max: 128
# Put a whitespace before `{` of brace blocks.
Layout/SpaceBeforeBlockBraces:
EnforcedStyle: space
# For a brace block written in one line, put whitespace between `{`, `}` and the inner contents.
Layout/SpaceInsideBlockBraces:
EnforcedStyle: space
# Do not put whitespace between method name and the parameter list.
Layout/SpaceAfterMethodName:
Enabled: true
# Put whitespace around operators, except for `**`.
Layout/SpaceAroundOperators:
Enabled: true
# Use the form of `{ key: value }`. Put whitespace after `:`.
Layout/SpaceAfterColon:
Enabled: true
# Put whitespaces between `{` and the first key, and between the last value and `}` when writing hash literals on a single line.
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: space
Enabled: true
# Leave exactly one newline at the end of a file.
Layout/TrailingEmptyLines:
EnforcedStyle: final_newline
Enabled: true
# Do not put whitespace at the end of a line.
Layout/TrailingWhitespace:
Enabled: true
# Use two spaces for 1-level of indent. Do not use the horizontal tab character.
Layout/IndentationStyle:
EnforcedStyle: spaces
Layout/IndentationWidth:
Enabled: true
Layout/IndentationConsistency:
Enabled: true
Layout/InitialIndentation:
Enabled: true
Layout/CommentIndentation:
Enabled: true
Lint/MissingSuper:
Enabled: false
# required cops from rubocop-performance gem
Performance/FlatMap:
Enabled: true
Performance/RedundantMerge:
Enabled: true
Performance/StartWith:
Enabled: true
Performance/EndWith:
Enabled: true
Performance/RegexpMatch:
Enabled: true
Performance/ReverseEach:
Enabled: true
Performance/UnfreezeString:
Enabled: true
# style (https://docs.rubocop.org/rubocop/cops_style.html)
Style/ParenthesesAroundCondition:
Enabled: true
Style/RedundantBegin:
Enabled: true
Style/RedundantReturn:
Enabled: true
AllowMultipleReturnValues: true
Style/Semicolon:
Enabled: true
AllowAsExpressionSeparator: true
# Prefer Foo.method over Foo::method
Style/ColonMethodCall:
Enabled: true
Style/TrivialAccessors:
Enabled: true
# Prefer &&/|| over and/or.
Style/AndOr:
Enabled: true
# Use quotes for string literals when they are enough.
Style/RedundantPercentQ:
Enabled: true
# Do not introduce new global variables (`$foo`) for any reason.
Style/GlobalVars:
Enabled: true
# Do not use class variables. Use `class_attribute` instead.
Style/ClassVars:
Enabled: true
# On method definition, do not omit parentheses of parameter list, except for methods without parameters.
Style/MethodDefParentheses:
Enabled: true
# In definitions of class methods, use `self.` prefix of method name.
Style/ClassMethods:
Enabled: true
# Use `attr_accessor`, `attr_reader`, and `attr_writer` to define accessors instead of `attr`.
Style/Attr:
Enabled: true
# Use `alias_method` instead of `alias` to define aliases of methods.
Style/Alias:
EnforcedStyle: prefer_alias_method
# Use `unless condition`, instead of `if !condition`.
Style/NegatedIf:
Enabled: true
# Use `until condition`, instead of `while !condition`.
Style/NegatedWhile:
Enabled: true
# Do not use `else` for `unless`.
Style/UnlessElse:
Enabled: true
# Parallel assignments can only be used for assigning literal values or results of methods without arguments, and for exchanging two variables or attributes.
Style/ParallelAssignment:
Enabled: true
# Do not nest conditional operators.
Style/NestedTernaryOperator:
Enabled: true
# Do not write conditional operators over multiple lines.
Style/MultilineTernaryOperator:
Enabled: true
# Do not write only `Object#to_s` in string interpolation, such as `"#{obj.to_s}"`.
Style/RedundantInterpolation:
Enabled: true
# Use `''` to write empty strings.
Style/EmptyLiteral:
Enabled: true
Style/FrozenStringLiteralComment:
Enabled: false
Style/Documentation:
Enabled: false
# metrics (https://docs.rubocop.org/rubocop/cops_metrics.html)
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/MethodLength:
Enabled: false