rubocop-dbl 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +9 -0
- data/README.md +126 -0
- data/config/dbl.yml +505 -0
- data/lib/generators/rubocop_dbl/install_generator.rb +33 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4bc3778cb0f67a617634f53135ce14e4e10d697c2f794fc85c73d5634b67fa52
|
4
|
+
data.tar.gz: 4137add4a7d9ddb7cc932f270ba75e8caffd7b3722a2b4fd09a9d8c9697a78de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8ef722d0bf8b8052b94765964eed84b62e2a7206ae1c96a5d1c6f7c9fa071b1eccda69f49a8c1d253cae7602189fc822fb7a41f4ef500f9342bc785853114137
|
7
|
+
data.tar.gz: 1cd3441be35e31eb7d87fd851f00f2d9f3489f239305d217466d569c928d05f0006b1fcf8f7a41a5cbe1a96832ba115e2794b679040b5777b780a7890c63a59c
|
data/LICENSE
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018-2020 Toshimaru
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
# DBL Rubocop
|
2
|
+
|
3
|
+
![Test](https://github.com/dbl-works/rubocop-dbl/workflows/Test/badge.svg?branch=main)
|
4
|
+
|
5
|
+
RuboCop configuration for our Ruby on Rails projects.
|
6
|
+
|
7
|
+
[Official RoR RuboCop Configuration](https://github.com/rails/rails/blob/master/.rubocop.yml).
|
8
|
+
|
9
|
+
Releases are published to [GitHub's Package Service](https://github.com/dbl-works/rubocop-dbl/packages/550489).
|
10
|
+
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Install from command line:
|
15
|
+
|
16
|
+
```shell
|
17
|
+
gem install rubocop-dbl --version "0.2.0" --source "https://rubygems.pkg.github.com/dbl-works"
|
18
|
+
```
|
19
|
+
|
20
|
+
install via Gemfile:
|
21
|
+
|
22
|
+
DO NOT DO THIS:
|
23
|
+
```ruby
|
24
|
+
group :development, :test do
|
25
|
+
gem "rubocop-dbl", "~> 0.2.0", source: "https://rubygems.pkg.github.com/dbl-works"
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
INSTEAD:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# Gemfile
|
33
|
+
group :development, :test do
|
34
|
+
gem 'rubocop-dbl', git: 'git@github.com:dbl-works/rubocop-dbl', branch: :main
|
35
|
+
end
|
36
|
+
```
|
37
|
+
WHY: we cannot install a public (!!) package from GitHub packages without a PAT (personal access token), see this [thread](https://github.community/t/download-from-github-package-registry-without-authentication/14407).
|
38
|
+
E.g. CircleCI does not allow reading a ENV var within the ci.yml, hence it is impossible to configure bundle to have auth for GitHub packages (this might work using GitHub actions).
|
39
|
+
|
40
|
+
|
41
|
+
## Usage
|
42
|
+
|
43
|
+
Add this line to your application's `.rubocop.yml`:
|
44
|
+
|
45
|
+
```yml
|
46
|
+
inherit_gem:
|
47
|
+
rubocop-dbl:
|
48
|
+
- config/dbl.yml
|
49
|
+
```
|
50
|
+
|
51
|
+
Or just run:
|
52
|
+
|
53
|
+
```shell
|
54
|
+
rails generate rubocop_dbl:install
|
55
|
+
```
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
## Configuration
|
60
|
+
|
61
|
+
|
62
|
+
### TargetRubyVersion
|
63
|
+
|
64
|
+
We only support the latest 2 versions of ruby, which is currently >= 2.6. See [test.yml](.github/workflows/test.yml) for details
|
65
|
+
|
66
|
+
If you'd like to change `TargetRubyVersion`, see [Customization](#customization).
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
## Customization
|
71
|
+
|
72
|
+
If you'd like to customize the rubocop setting on your project, you can override it.
|
73
|
+
|
74
|
+
For example, if you want to change `TargetRubyVersion`, you can do it like:
|
75
|
+
|
76
|
+
```yml
|
77
|
+
# .rubocop.yml
|
78
|
+
inherit_gem:
|
79
|
+
rubocop-dbl:
|
80
|
+
- config/dbl.yml
|
81
|
+
|
82
|
+
# Override Setting
|
83
|
+
AllCops:
|
84
|
+
TargetRubyVersion: 2.7.2
|
85
|
+
```
|
86
|
+
|
87
|
+
## Build & install gem locally
|
88
|
+
```shell
|
89
|
+
gem build rubocop-dbl.gemspec
|
90
|
+
gem install rubocop-dbl-0.1.0.gem
|
91
|
+
irb
|
92
|
+
```
|
93
|
+
|
94
|
+
## Publish as package on GitHub packages
|
95
|
+
* create a valid PAT (personal access token) for your GitHub user with full access to packages (read & write) and private repos (read), read the [docs](https://docs.github.com/en/free-pro-team@latest/packages/guides/configuring-rubygems-for-use-with-github-packages) for more details
|
96
|
+
* add following information to `~/.gemrc`:
|
97
|
+
|
98
|
+
```
|
99
|
+
---
|
100
|
+
:github: YOUR_PAT
|
101
|
+
:backtrace: false
|
102
|
+
:bulk_threshold: 1000
|
103
|
+
:sources:
|
104
|
+
- https://rubygems.org/
|
105
|
+
- https://rubygems.pkg.github.com
|
106
|
+
:update_sources: true
|
107
|
+
:verbose: true
|
108
|
+
:concurrent_downloads: 8
|
109
|
+
gem: "--document=yri"
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
* build the latest version of the gem locally with
|
114
|
+
|
115
|
+
```shell
|
116
|
+
gem build rubocop-dbl.gemspec
|
117
|
+
```
|
118
|
+
take note of the most current version of the gem, which will be printed to console.
|
119
|
+
|
120
|
+
* publish the gem as follows
|
121
|
+
|
122
|
+
```shell
|
123
|
+
gem push --key github --host https://YOUR_GITHUB_USER_NAME:YOUR_PAT@rubygems.pkg.github.com/dbl-works rubocop-dbl-CURRENT_GEM_VERSION.gem
|
124
|
+
```
|
125
|
+
|
126
|
+
replacing `YOUR_GITHUB_USER_NAME`, `YOUR_PAT`, `CURRENT_GEM_VERSION` with the appropriate values.
|
data/config/dbl.yml
ADDED
@@ -0,0 +1,505 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-packaging
|
3
|
+
- rubocop-performance
|
4
|
+
- rubocop-rspec
|
5
|
+
- rubocop-rails
|
6
|
+
|
7
|
+
#############
|
8
|
+
#############
|
9
|
+
#############
|
10
|
+
# @TODO: we will have to agree on some rules here and update this file
|
11
|
+
#############
|
12
|
+
#############
|
13
|
+
#############
|
14
|
+
|
15
|
+
AllCops:
|
16
|
+
UseCache: true
|
17
|
+
MaxFilesInCache: 5
|
18
|
+
CacheRootDirectory: ./tmp/**
|
19
|
+
TargetRubyVersion: 2.7.2
|
20
|
+
NewCops: enable
|
21
|
+
Exclude:
|
22
|
+
- '**/tmp/**/*'
|
23
|
+
- '**/templates/**/*'
|
24
|
+
- '**/vendor/**/*'
|
25
|
+
- 'actionpack/lib/action_dispatch/journey/parser.rb'
|
26
|
+
- 'actionmailbox/test/dummy/**/*'
|
27
|
+
- 'actiontext/test/dummy/**/*'
|
28
|
+
- '**/node_modules/**/*'
|
29
|
+
# Additional exclude files by rubocop-rails
|
30
|
+
- 'bin/**/*'
|
31
|
+
- 'config/**/*'
|
32
|
+
- 'db/**/*'
|
33
|
+
|
34
|
+
Rails/UnknownEnv:
|
35
|
+
Environments:
|
36
|
+
- production
|
37
|
+
- development
|
38
|
+
- test
|
39
|
+
- staging
|
40
|
+
|
41
|
+
Rails/HttpStatus:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Rails/ApplicationController:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
# Prefer assert_not over assert !
|
48
|
+
Rails/AssertNot:
|
49
|
+
Include:
|
50
|
+
- '**/test/**/*'
|
51
|
+
|
52
|
+
# Prefer assert_not_x over refute_x
|
53
|
+
Rails/RefuteMethods:
|
54
|
+
Include:
|
55
|
+
- '**/test/**/*'
|
56
|
+
|
57
|
+
Rails/IndexBy:
|
58
|
+
Enabled: true
|
59
|
+
|
60
|
+
Rails/IndexWith:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
Rails/ActiveRecordCallbacksOrder:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Rails/AfterCommitOverride:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Rails/AttributeDefaultBlockValue:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Rails/FindById:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Rails/Inquiry:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Rails/MailerName:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Rails/MatchRoute:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Rails/NegateInclude:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
Rails/Pluck:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
Rails/PluckInWhere:
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
Rails/RenderInline:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Rails/RenderPlainText:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
Rails/ShortI18n:
|
100
|
+
Enabled: true
|
101
|
+
EnforcedStyle: aggressive
|
102
|
+
|
103
|
+
Rails/SquishedSQLHeredocs:
|
104
|
+
Enabled: true
|
105
|
+
|
106
|
+
Rails/WhereEquals:
|
107
|
+
Enabled: true
|
108
|
+
|
109
|
+
Rails/WhereExists:
|
110
|
+
Enabled: true
|
111
|
+
|
112
|
+
Rails/WhereNot:
|
113
|
+
Enabled: true
|
114
|
+
|
115
|
+
# Layout
|
116
|
+
|
117
|
+
# Align `when` with `case`.
|
118
|
+
Layout/CaseIndentation:
|
119
|
+
Enabled: true
|
120
|
+
|
121
|
+
Layout/ClosingHeredocIndentation:
|
122
|
+
Enabled: true
|
123
|
+
|
124
|
+
# Align comments with method definitions.
|
125
|
+
Layout/CommentIndentation:
|
126
|
+
Enabled: true
|
127
|
+
|
128
|
+
Layout/ElseAlignment:
|
129
|
+
Enabled: true
|
130
|
+
|
131
|
+
# Align `end` with the matching keyword or starting expression except for
|
132
|
+
# assignments, where it should be aligned with the LHS.
|
133
|
+
Layout/EndAlignment:
|
134
|
+
Enabled: true
|
135
|
+
EnforcedStyleAlignWith: variable
|
136
|
+
AutoCorrect: true
|
137
|
+
|
138
|
+
Layout/ParameterAlignment:
|
139
|
+
EnforcedStyle: with_fixed_indentation
|
140
|
+
SupportedStyles:
|
141
|
+
- with_first_parameter
|
142
|
+
- with_fixed_indentation
|
143
|
+
|
144
|
+
Layout/EmptyLineAfterMagicComment:
|
145
|
+
Enabled: true
|
146
|
+
|
147
|
+
Layout/EmptyLinesAroundAccessModifier:
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
Layout/EmptyLinesAroundBlockBody:
|
151
|
+
Enabled: true
|
152
|
+
|
153
|
+
# In a regular class definition, no empty lines around the body.
|
154
|
+
Layout/EmptyLinesAroundClassBody:
|
155
|
+
Enabled: true
|
156
|
+
|
157
|
+
# In a regular method definition, no empty lines around the body.
|
158
|
+
Layout/EmptyLinesAroundMethodBody:
|
159
|
+
Enabled: true
|
160
|
+
|
161
|
+
# In a regular module definition, no empty lines around the body.
|
162
|
+
Layout/EmptyLinesAroundModuleBody:
|
163
|
+
Enabled: true
|
164
|
+
|
165
|
+
Layout/FirstArgumentIndentation:
|
166
|
+
Enabled: true
|
167
|
+
|
168
|
+
Layout/IndentationConsistency:
|
169
|
+
Enabled: true
|
170
|
+
|
171
|
+
# Two spaces, no tabs (for indentation).
|
172
|
+
Layout/IndentationWidth:
|
173
|
+
Enabled: true
|
174
|
+
|
175
|
+
Layout/LeadingCommentSpace:
|
176
|
+
Enabled: true
|
177
|
+
|
178
|
+
Layout/SpaceAfterColon:
|
179
|
+
Enabled: true
|
180
|
+
|
181
|
+
Layout/SpaceAfterComma:
|
182
|
+
Enabled: true
|
183
|
+
|
184
|
+
Layout/SpaceAfterSemicolon:
|
185
|
+
Enabled: true
|
186
|
+
|
187
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
188
|
+
Enabled: true
|
189
|
+
|
190
|
+
Layout/SpaceAroundKeyword:
|
191
|
+
Enabled: true
|
192
|
+
|
193
|
+
Layout/SpaceAroundOperators:
|
194
|
+
Enabled: true
|
195
|
+
|
196
|
+
Layout/SpaceBeforeComma:
|
197
|
+
Enabled: true
|
198
|
+
|
199
|
+
Layout/SpaceBeforeComment:
|
200
|
+
Enabled: true
|
201
|
+
|
202
|
+
Layout/SpaceBeforeFirstArg:
|
203
|
+
Enabled: true
|
204
|
+
|
205
|
+
# Use `foo {}` not `foo{}`.
|
206
|
+
Layout/SpaceBeforeBlockBraces:
|
207
|
+
Enabled: true
|
208
|
+
|
209
|
+
# Use `foo { bar }` not `foo {bar}`.
|
210
|
+
Layout/SpaceInsideBlockBraces:
|
211
|
+
Enabled: true
|
212
|
+
EnforcedStyleForEmptyBraces: space
|
213
|
+
|
214
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
215
|
+
Layout/SpaceInsideHashLiteralBraces:
|
216
|
+
Enabled: true
|
217
|
+
|
218
|
+
Layout/SpaceInsideParens:
|
219
|
+
Enabled: true
|
220
|
+
|
221
|
+
# Detect hard tabs, no hard tabs.
|
222
|
+
Layout/IndentationStyle:
|
223
|
+
Enabled: true
|
224
|
+
|
225
|
+
# Empty lines should not have any spaces.
|
226
|
+
Layout/TrailingEmptyLines:
|
227
|
+
Enabled: true
|
228
|
+
|
229
|
+
# No trailing whitespace.
|
230
|
+
Layout/TrailingWhitespace:
|
231
|
+
Enabled: true
|
232
|
+
|
233
|
+
Layout/HashAlignment:
|
234
|
+
EnforcedHashRocketStyle: key
|
235
|
+
EnforcedColonStyle: key
|
236
|
+
|
237
|
+
|
238
|
+
# Naming
|
239
|
+
|
240
|
+
Naming/VariableNumber:
|
241
|
+
EnforcedStyle: snake_case
|
242
|
+
|
243
|
+
# Style
|
244
|
+
|
245
|
+
# Prefer &&/|| over and/or.
|
246
|
+
Style/AndOr:
|
247
|
+
Enabled: true
|
248
|
+
|
249
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
250
|
+
Style/HashSyntax:
|
251
|
+
Enabled: true
|
252
|
+
|
253
|
+
Style/DefWithParentheses:
|
254
|
+
Enabled: true
|
255
|
+
|
256
|
+
# Defining a method with parameters needs parentheses.
|
257
|
+
Style/MethodDefParentheses:
|
258
|
+
Enabled: true
|
259
|
+
|
260
|
+
Style/FrozenStringLiteralComment:
|
261
|
+
EnforcedStyle: never
|
262
|
+
|
263
|
+
Style/RedundantFreeze:
|
264
|
+
Enabled: true
|
265
|
+
|
266
|
+
# Check quotes usage according to lint rule below.
|
267
|
+
Style/StringLiterals:
|
268
|
+
Enabled: true
|
269
|
+
EnforcedStyle: single_quotes
|
270
|
+
|
271
|
+
# Use quotes for string literals when they are enough.
|
272
|
+
Style/RedundantPercentQ:
|
273
|
+
Enabled: true
|
274
|
+
|
275
|
+
Style/ParenthesesAroundCondition:
|
276
|
+
Enabled: true
|
277
|
+
|
278
|
+
Style/HashTransformKeys:
|
279
|
+
Enabled: true
|
280
|
+
|
281
|
+
Style/HashTransformValues:
|
282
|
+
Enabled: true
|
283
|
+
|
284
|
+
# enforces to use 'name'.to_sym over 'name'.intern and so on
|
285
|
+
Style/StringMethods:
|
286
|
+
Enabled: true
|
287
|
+
|
288
|
+
Style/EmptyMethod:
|
289
|
+
EnforcedStyle: expanded
|
290
|
+
SupportedStyles:
|
291
|
+
- compact
|
292
|
+
- expanded
|
293
|
+
|
294
|
+
Style/SymbolArray:
|
295
|
+
Enabled: true
|
296
|
+
|
297
|
+
Style/RedundantBegin:
|
298
|
+
Enabled: true
|
299
|
+
|
300
|
+
Style/RedundantReturn:
|
301
|
+
Enabled: true
|
302
|
+
AllowMultipleReturnValues: true
|
303
|
+
|
304
|
+
Style/RedundantRegexpEscape:
|
305
|
+
Enabled: true
|
306
|
+
|
307
|
+
Style/Semicolon:
|
308
|
+
Enabled: true
|
309
|
+
AllowAsExpressionSeparator: true
|
310
|
+
|
311
|
+
# Prefer Foo.method over Foo::method
|
312
|
+
Style/ColonMethodCall:
|
313
|
+
Enabled: true
|
314
|
+
|
315
|
+
Style/CollectionMethods:
|
316
|
+
Enabled: true
|
317
|
+
|
318
|
+
Style/Documentation:
|
319
|
+
Enabled: false
|
320
|
+
|
321
|
+
Style/TrivialAccessors:
|
322
|
+
Enabled: true
|
323
|
+
|
324
|
+
Style/ArgumentsForwarding:
|
325
|
+
Enabled: false
|
326
|
+
|
327
|
+
Style/CollectionCompact:
|
328
|
+
Enabled: true
|
329
|
+
|
330
|
+
Style/DocumentDynamicEvalDefinition:
|
331
|
+
Enabled: true
|
332
|
+
|
333
|
+
Style/NegatedIfElseCondition:
|
334
|
+
Enabled: true
|
335
|
+
|
336
|
+
Style/NilLambda:
|
337
|
+
Enabled: true
|
338
|
+
|
339
|
+
Style/RedundantArgument:
|
340
|
+
Enabled: true
|
341
|
+
|
342
|
+
Style/SwapValues:
|
343
|
+
Enabled: true
|
344
|
+
|
345
|
+
Style/TrailingCommaInArguments:
|
346
|
+
EnforcedStyleForMultiline: comma
|
347
|
+
|
348
|
+
Style/TrailingCommaInArrayLiteral:
|
349
|
+
EnforcedStyleForMultiline: comma
|
350
|
+
|
351
|
+
Style/TrailingCommaInHashLiteral:
|
352
|
+
EnforcedStyleForMultiline: comma
|
353
|
+
|
354
|
+
# Metrics
|
355
|
+
|
356
|
+
Metrics/BlockLength:
|
357
|
+
IgnoredMethods: ['describe', 'context', 'feature', 'scenario']
|
358
|
+
|
359
|
+
# Lint
|
360
|
+
|
361
|
+
Lint/AmbiguousOperator:
|
362
|
+
Enabled: true
|
363
|
+
|
364
|
+
Lint/AmbiguousRegexpLiteral:
|
365
|
+
Enabled: true
|
366
|
+
|
367
|
+
Lint/ErbNewArguments:
|
368
|
+
Enabled: true
|
369
|
+
|
370
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
371
|
+
Lint/RequireParentheses:
|
372
|
+
Enabled: true
|
373
|
+
|
374
|
+
Lint/ShadowingOuterLocalVariable:
|
375
|
+
Enabled: true
|
376
|
+
|
377
|
+
Lint/RedundantStringCoercion:
|
378
|
+
Enabled: true
|
379
|
+
|
380
|
+
Lint/UriEscapeUnescape:
|
381
|
+
Enabled: true
|
382
|
+
|
383
|
+
Lint/UselessAssignment:
|
384
|
+
Enabled: true
|
385
|
+
|
386
|
+
Lint/DeprecatedClassMethods:
|
387
|
+
Enabled: true
|
388
|
+
|
389
|
+
Lint/DuplicateBranch:
|
390
|
+
Enabled: true
|
391
|
+
|
392
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
393
|
+
Enabled: true
|
394
|
+
|
395
|
+
Lint/EmptyBlock:
|
396
|
+
Enabled: true
|
397
|
+
|
398
|
+
Lint/EmptyClass:
|
399
|
+
Enabled: true
|
400
|
+
|
401
|
+
Lint/NoReturnInBeginEndBlocks:
|
402
|
+
Enabled: true
|
403
|
+
|
404
|
+
Lint/ToEnumArguments:
|
405
|
+
Enabled: true
|
406
|
+
|
407
|
+
Lint/UnexpectedBlockArity:
|
408
|
+
Enabled: true
|
409
|
+
|
410
|
+
Lint/UnmodifiedReduceAccumulator:
|
411
|
+
Enabled: true
|
412
|
+
|
413
|
+
|
414
|
+
# Performance
|
415
|
+
|
416
|
+
Performance:
|
417
|
+
Exclude:
|
418
|
+
- '**/test/**/*'
|
419
|
+
|
420
|
+
Performance/FlatMap:
|
421
|
+
Enabled: true
|
422
|
+
|
423
|
+
Performance/RedundantMerge:
|
424
|
+
Enabled: true
|
425
|
+
|
426
|
+
Performance/StartWith:
|
427
|
+
Enabled: true
|
428
|
+
|
429
|
+
Performance/EndWith:
|
430
|
+
Enabled: true
|
431
|
+
|
432
|
+
Performance/RegexpMatch:
|
433
|
+
Enabled: true
|
434
|
+
|
435
|
+
Performance/ReverseEach:
|
436
|
+
Enabled: true
|
437
|
+
|
438
|
+
Performance/UnfreezeString:
|
439
|
+
Enabled: true
|
440
|
+
|
441
|
+
Performance/DeletePrefix:
|
442
|
+
Enabled: true
|
443
|
+
|
444
|
+
Performance/DeleteSuffix:
|
445
|
+
Enabled: true
|
446
|
+
|
447
|
+
Performance/AncestorsInclude:
|
448
|
+
Enabled: true
|
449
|
+
|
450
|
+
Performance/BigDecimalWithNumericArgument:
|
451
|
+
Enabled: false
|
452
|
+
|
453
|
+
Performance/BlockGivenWithExplicitBlock:
|
454
|
+
Enabled: true
|
455
|
+
|
456
|
+
Performance/CollectionLiteralInLoop:
|
457
|
+
Enabled: true
|
458
|
+
|
459
|
+
Performance/ConstantRegexp:
|
460
|
+
Enabled: true
|
461
|
+
|
462
|
+
Performance/MethodObjectAsBlock:
|
463
|
+
Enabled: false
|
464
|
+
|
465
|
+
Performance/RedundantSortBlock:
|
466
|
+
Enabled: true
|
467
|
+
|
468
|
+
Performance/RedundantStringChars:
|
469
|
+
Enabled: true
|
470
|
+
|
471
|
+
Performance/ReverseFirst:
|
472
|
+
Enabled: true
|
473
|
+
|
474
|
+
Performance/SortReverse:
|
475
|
+
Enabled: true
|
476
|
+
|
477
|
+
Performance/Squeeze:
|
478
|
+
Enabled: true
|
479
|
+
|
480
|
+
Performance/StringInclude:
|
481
|
+
Enabled: true
|
482
|
+
|
483
|
+
Performance/Sum:
|
484
|
+
Enabled: true
|
485
|
+
|
486
|
+
# Rspec rules
|
487
|
+
|
488
|
+
RSpec/ContextWording:
|
489
|
+
Prefixes:
|
490
|
+
- when
|
491
|
+
- with
|
492
|
+
- without
|
493
|
+
- if
|
494
|
+
- and
|
495
|
+
|
496
|
+
RSpec/Capybara/FeatureMethods:
|
497
|
+
EnabledMethods:
|
498
|
+
- feature
|
499
|
+
- scenario
|
500
|
+
|
501
|
+
RSpec/NestedGroups:
|
502
|
+
Max: 5
|
503
|
+
|
504
|
+
RSpec/MultipleMemoizedHelpers:
|
505
|
+
Max: 6
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
require 'active_support/core_ext/string'
|
3
|
+
|
4
|
+
module RubocopDbl
|
5
|
+
module Generators
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
desc 'Creates a .rubocop.yml config file that inherits from the official Ruby on Rails .rubocop.yml.'
|
8
|
+
|
9
|
+
def create_config_file
|
10
|
+
file_method = config_file_exists? ? :prepend : :create
|
11
|
+
send :"#{file_method}_file", config_file_path, config_file_content
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def config_file_exists?
|
17
|
+
File.exist?(config_file_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def config_file_path
|
21
|
+
'.rubocop.yml'
|
22
|
+
end
|
23
|
+
|
24
|
+
def config_file_content
|
25
|
+
<<~HEREDOC
|
26
|
+
inherit_gem:
|
27
|
+
rubocop-dbl:
|
28
|
+
- config/dbl.yml
|
29
|
+
HEREDOC
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubocop-dbl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- 'Team DBL :rocket:'
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-04-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-ast
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop-packaging
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.4'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-performance
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.1'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.1'
|
111
|
+
description: RuboCop configuration for our Ruby on Rails projects
|
112
|
+
email: me@toshimaru.net
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- LICENSE
|
118
|
+
- README.md
|
119
|
+
- config/dbl.yml
|
120
|
+
- lib/generators/rubocop_dbl/install_generator.rb
|
121
|
+
homepage: https://github.com/dbl-works/rubocop-dbl
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 2.4.0
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubygems_version: 3.0.3
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: RuboCop configuration for our Ruby on Rails projects
|
144
|
+
test_files: []
|