rubocop-platanus 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +24 -0
- data/.rspec +3 -0
- data/.rubocop.yml +497 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +8 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +115 -0
- data/Guardfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +110 -0
- data/Rakefile +35 -0
- data/config/default.yml +6 -0
- data/lib/rubocop/cop/platanus/no_command.rb +41 -0
- data/lib/rubocop/cop/platanus_cops.rb +3 -0
- data/lib/rubocop/platanus/inject.rb +20 -0
- data/lib/rubocop/platanus/version.rb +7 -0
- data/lib/rubocop/platanus.rb +15 -0
- data/lib/rubocop-platanus.rb +11 -0
- data/sig/rubocop/platanus.rbs +6 -0
- metadata +189 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a03dfa4de53bd8b6ecc894167346f22ae13d475c5388990d014b8cf910a36aa7
|
4
|
+
data.tar.gz: aa8b77d809a7c927feb85fbc2611bca678025243e2997a98aea81bc25fa25d68
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f8e068755dca01d916faa1e80696d4a7e169d805829a0c62f3fba93f30ca76e55208ba70116d844d12c0c84d71ebf02d0cedc70f90658a0fc49624471ebcdeb
|
7
|
+
data.tar.gz: 80a86b5d5706bb9306c14a10b030f6500fce2b7f66e26c30247419f2b16527ab7e7e891b235c251f2554fd4583798267af01438d225045f9b1dd679644aa321c
|
data/.editorconfig
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# EditorConfig helps developers define and maintain consistent
|
2
|
+
# coding styles between different editors and IDEs
|
3
|
+
# editorconfig.org
|
4
|
+
|
5
|
+
root = true
|
6
|
+
|
7
|
+
[*]
|
8
|
+
|
9
|
+
# Change these settings to your own preference
|
10
|
+
indent_style = space
|
11
|
+
indent_size = 2
|
12
|
+
|
13
|
+
# We recommend you to keep these unchanged
|
14
|
+
end_of_line = lf
|
15
|
+
charset = utf-8
|
16
|
+
trim_trailing_whitespace = true
|
17
|
+
insert_final_newline = true
|
18
|
+
|
19
|
+
[*.js]
|
20
|
+
indent_style = space
|
21
|
+
indent_size = 2
|
22
|
+
|
23
|
+
[*.md]
|
24
|
+
trim_trailing_whitespace = false
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,497 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- "vendor/**/*"
|
4
|
+
- "db/**/*"
|
5
|
+
- "bin/**/*"
|
6
|
+
TargetRubyVersion: 2.7
|
7
|
+
Layout/ParameterAlignment:
|
8
|
+
Description: Align the parameters of a method call if they span more than one line.
|
9
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-double-indent
|
10
|
+
Enabled: true
|
11
|
+
EnforcedStyle: with_fixed_indentation
|
12
|
+
SupportedStyles:
|
13
|
+
- with_first_parameter
|
14
|
+
- with_fixed_indentation
|
15
|
+
Metrics/BlockLength:
|
16
|
+
Enabled: false
|
17
|
+
Style/ClassAndModuleChildren:
|
18
|
+
Description: Checks style of children classes and modules.
|
19
|
+
Enabled: false
|
20
|
+
EnforcedStyle: nested
|
21
|
+
SupportedStyles:
|
22
|
+
- nested
|
23
|
+
- compact
|
24
|
+
Style/CommentAnnotation:
|
25
|
+
Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK,
|
26
|
+
REVIEW).
|
27
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#annotate-keywords
|
28
|
+
Enabled: false
|
29
|
+
Keywords:
|
30
|
+
- TODO
|
31
|
+
- FIXME
|
32
|
+
- OPTIMIZE
|
33
|
+
- HACK
|
34
|
+
- REVIEW
|
35
|
+
Naming/FileName:
|
36
|
+
Description: Use snake_case for source file names.
|
37
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
|
38
|
+
Enabled: false
|
39
|
+
Exclude:
|
40
|
+
- lib/rubocop-platanus.rb
|
41
|
+
Style/FormatString:
|
42
|
+
Description: Enforce the use of Kernel#sprintf, Kernel#format or String#%.
|
43
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#sprintf
|
44
|
+
Enabled: false
|
45
|
+
EnforcedStyle: format
|
46
|
+
SupportedStyles:
|
47
|
+
- format
|
48
|
+
- sprintf
|
49
|
+
- percent
|
50
|
+
Style/FrozenStringLiteralComment:
|
51
|
+
Enabled: false
|
52
|
+
Style/GlobalVars:
|
53
|
+
Description: Do not introduce global variables.
|
54
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#instance-vars
|
55
|
+
Enabled: false
|
56
|
+
AllowedVariables: []
|
57
|
+
Style/GuardClause:
|
58
|
+
Description: Check for conditionals that can be replaced with guard clauses
|
59
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
|
60
|
+
Enabled: false
|
61
|
+
MinBodyLength: 1
|
62
|
+
Style/IfUnlessModifier:
|
63
|
+
Description: Favor modifier if/unless usage when you have a single-line body.
|
64
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
|
65
|
+
Enabled: false
|
66
|
+
Style/LambdaCall:
|
67
|
+
Description: Use lambda.call(...) instead of lambda.(...).
|
68
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc-call
|
69
|
+
Enabled: false
|
70
|
+
EnforcedStyle: call
|
71
|
+
SupportedStyles:
|
72
|
+
- call
|
73
|
+
- braces
|
74
|
+
Style/Next:
|
75
|
+
Description: Use `next` to skip iteration instead of a condition at the end.
|
76
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
|
77
|
+
Enabled: false
|
78
|
+
EnforcedStyle: skip_modifier_ifs
|
79
|
+
MinBodyLength: 3
|
80
|
+
SupportedStyles:
|
81
|
+
- skip_modifier_ifs
|
82
|
+
- always
|
83
|
+
Layout/MultilineOperationIndentation:
|
84
|
+
Description: Checks indentation of binary operations that span more than one line.
|
85
|
+
Enabled: true
|
86
|
+
EnforcedStyle: indented
|
87
|
+
SupportedStyles:
|
88
|
+
- aligned
|
89
|
+
- indented
|
90
|
+
Style/MutableConstant:
|
91
|
+
Description: Do not assign mutable objects to constants.
|
92
|
+
Enabled: false
|
93
|
+
Style/NumericLiterals:
|
94
|
+
Description: Add underscores to large numeric literals to improve their readability.
|
95
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics
|
96
|
+
Enabled: false
|
97
|
+
MinDigits: 5
|
98
|
+
Style/PercentLiteralDelimiters:
|
99
|
+
Description: Use `%`-literal delimiters consistently
|
100
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
|
101
|
+
Enabled: false
|
102
|
+
PreferredDelimiters:
|
103
|
+
"%": "()"
|
104
|
+
"%i": "()"
|
105
|
+
"%q": "()"
|
106
|
+
"%Q": "()"
|
107
|
+
"%r": "{}"
|
108
|
+
"%s": "()"
|
109
|
+
"%w": "()"
|
110
|
+
"%W": "()"
|
111
|
+
"%x": "()"
|
112
|
+
Naming/PredicateName:
|
113
|
+
Description: Check the names of predicate methods.
|
114
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
|
115
|
+
Enabled: true
|
116
|
+
NamePrefix:
|
117
|
+
- is_
|
118
|
+
- has_
|
119
|
+
- have_
|
120
|
+
ForbiddenPrefixes:
|
121
|
+
- is_
|
122
|
+
Style/RaiseArgs:
|
123
|
+
Description: Checks the arguments passed to raise/fail.
|
124
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
|
125
|
+
Enabled: false
|
126
|
+
EnforcedStyle: exploded
|
127
|
+
SupportedStyles:
|
128
|
+
- compact
|
129
|
+
- exploded
|
130
|
+
Style/SignalException:
|
131
|
+
Description: Checks for proper usage of fail and raise.
|
132
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
|
133
|
+
Enabled: false
|
134
|
+
EnforcedStyle: semantic
|
135
|
+
SupportedStyles:
|
136
|
+
- only_raise
|
137
|
+
- only_fail
|
138
|
+
- semantic
|
139
|
+
Style/SingleLineMethods:
|
140
|
+
Description: Avoid single-line methods.
|
141
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
|
142
|
+
Enabled: false
|
143
|
+
AllowIfMethodIsEmpty: true
|
144
|
+
Style/StringLiterals:
|
145
|
+
Description: Checks if uses of quotes match the configured preference.
|
146
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
|
147
|
+
Enabled: false
|
148
|
+
EnforcedStyle: double_quotes
|
149
|
+
SupportedStyles:
|
150
|
+
- single_quotes
|
151
|
+
- double_quotes
|
152
|
+
Style/TrailingCommaInArguments:
|
153
|
+
Description: Checks for trailing comma in argument lists.
|
154
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
|
155
|
+
Enabled: true
|
156
|
+
Style/TrailingCommaInArrayLiteral:
|
157
|
+
Description: Checks for trailing comma in array and hash literals.
|
158
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-trailing-array-commas
|
159
|
+
Enabled: true
|
160
|
+
Style/TrailingCommaInHashLiteral:
|
161
|
+
Description: Checks for trailing comma in array and hash literals.
|
162
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-trailing-array-commas
|
163
|
+
Enabled: true
|
164
|
+
Style/TrivialAccessors:
|
165
|
+
Description: Prefer attr_* methods to trivial readers/writers.
|
166
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr_family
|
167
|
+
Enabled: false
|
168
|
+
ExactNameMatch: false
|
169
|
+
AllowPredicates: false
|
170
|
+
AllowDSLWriters: false
|
171
|
+
AllowedMethods:
|
172
|
+
- to_ary
|
173
|
+
- to_a
|
174
|
+
- to_c
|
175
|
+
- to_enum
|
176
|
+
- to_h
|
177
|
+
- to_hash
|
178
|
+
- to_i
|
179
|
+
- to_int
|
180
|
+
- to_io
|
181
|
+
- to_open
|
182
|
+
- to_path
|
183
|
+
- to_proc
|
184
|
+
- to_r
|
185
|
+
- to_regexp
|
186
|
+
- to_str
|
187
|
+
- to_s
|
188
|
+
- to_sym
|
189
|
+
Style/WhileUntilModifier:
|
190
|
+
Description: Favor modifier while/until usage when you have a single-line body.
|
191
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier
|
192
|
+
Enabled: false
|
193
|
+
Style/ExponentialNotation:
|
194
|
+
Enabled: true
|
195
|
+
Style/HashEachMethods:
|
196
|
+
Description: Use Hash#each_key and Hash#each_value.
|
197
|
+
Enabled: true
|
198
|
+
Style/HashTransformKeys:
|
199
|
+
Description: Prefer `transform_keys` over `each_with_object` and `map`.
|
200
|
+
Enabled: true
|
201
|
+
Style/HashTransformValues:
|
202
|
+
Description: Prefer `transform_values` over `each_with_object` and `map`.
|
203
|
+
Enabled: true
|
204
|
+
Metrics/AbcSize:
|
205
|
+
Description: A calculated magnitude based on number of assignments, branches, and
|
206
|
+
conditions.
|
207
|
+
Enabled: true
|
208
|
+
Max: 25
|
209
|
+
Metrics/BlockNesting:
|
210
|
+
Description: Avoid excessive block nesting
|
211
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count
|
212
|
+
Enabled: true
|
213
|
+
Max: 3
|
214
|
+
Metrics/ClassLength:
|
215
|
+
Description: Avoid classes longer than 100 lines of code.
|
216
|
+
Enabled: false
|
217
|
+
CountComments: false
|
218
|
+
Max: 100
|
219
|
+
Metrics/MethodLength:
|
220
|
+
Description: Avoid methods longer than 15 lines of code.
|
221
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
|
222
|
+
Enabled: true
|
223
|
+
CountComments: true
|
224
|
+
Max: 15
|
225
|
+
Exclude:
|
226
|
+
- "spec/**/*"
|
227
|
+
Metrics/ParameterLists:
|
228
|
+
Description: Avoid long parameter lists.
|
229
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
|
230
|
+
Enabled: false
|
231
|
+
Max: 5
|
232
|
+
CountKeywordArgs: true
|
233
|
+
Lint/AssignmentInCondition:
|
234
|
+
Description: Don't use assignment in conditions.
|
235
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
|
236
|
+
Enabled: false
|
237
|
+
AllowSafeAssignment: true
|
238
|
+
Layout/LineLength:
|
239
|
+
Description: Limit lines to 100 characters.
|
240
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#100-character-limits
|
241
|
+
Enabled: true
|
242
|
+
Max: 100
|
243
|
+
AllowURI: true
|
244
|
+
URISchemes:
|
245
|
+
- http
|
246
|
+
- https
|
247
|
+
Layout/EndAlignment:
|
248
|
+
Description: Align ends correctly.
|
249
|
+
Enabled: true
|
250
|
+
EnforcedStyleAlignWith: keyword
|
251
|
+
SupportedStylesAlignWith:
|
252
|
+
- keyword
|
253
|
+
- variable
|
254
|
+
Layout/DefEndAlignment:
|
255
|
+
Description: Align ends corresponding to defs correctly.
|
256
|
+
Enabled: true
|
257
|
+
EnforcedStyleAlignWith: start_of_line
|
258
|
+
SupportedStylesAlignWith:
|
259
|
+
- start_of_line
|
260
|
+
- def
|
261
|
+
Layout/SpaceAroundMethodCallOperator:
|
262
|
+
Description: Checks method call operators to not have spaces around them.
|
263
|
+
Enabled: true
|
264
|
+
Style/SymbolArray:
|
265
|
+
Description: Use %i or %I for arrays of symbols.
|
266
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-i
|
267
|
+
Enabled: false
|
268
|
+
Layout/ExtraSpacing:
|
269
|
+
Description: Do not use unnecessary spacing.
|
270
|
+
Enabled: false
|
271
|
+
Naming/AccessorMethodName:
|
272
|
+
Description: Check the naming of accessor methods for get_/set_.
|
273
|
+
Enabled: false
|
274
|
+
Style/Alias:
|
275
|
+
Description: Use alias_method instead of alias.
|
276
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
|
277
|
+
Enabled: false
|
278
|
+
Style/ArrayJoin:
|
279
|
+
Description: Use Array#join instead of Array#*.
|
280
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#array-join
|
281
|
+
Enabled: false
|
282
|
+
Style/AsciiComments:
|
283
|
+
Description: Use only ascii symbols in comments.
|
284
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#english-comments
|
285
|
+
Enabled: false
|
286
|
+
Naming/AsciiIdentifiers:
|
287
|
+
Description: Use only ascii symbols in identifiers.
|
288
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#english-identifiers
|
289
|
+
Enabled: false
|
290
|
+
Style/Attr:
|
291
|
+
Description: Checks for uses of Module#attr.
|
292
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr
|
293
|
+
Enabled: false
|
294
|
+
Style/BlockComments:
|
295
|
+
Description: Do not use block comments.
|
296
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-block-comments
|
297
|
+
Enabled: false
|
298
|
+
Style/CaseEquality:
|
299
|
+
Description: Avoid explicit use of the case equality operator(===).
|
300
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-case-equality
|
301
|
+
Enabled: false
|
302
|
+
Style/CharacterLiteral:
|
303
|
+
Description: Checks for uses of character literals.
|
304
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-character-literals
|
305
|
+
Enabled: false
|
306
|
+
Style/ClassVars:
|
307
|
+
Description: Avoid the use of class variables.
|
308
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-class-vars
|
309
|
+
Enabled: false
|
310
|
+
Style/ColonMethodCall:
|
311
|
+
Description: 'Do not use :: for method call.'
|
312
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#double-colons
|
313
|
+
Enabled: false
|
314
|
+
Style/PreferredHashMethods:
|
315
|
+
Description: Checks for use of deprecated Hash methods.
|
316
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-key
|
317
|
+
Enabled: false
|
318
|
+
Style/Documentation:
|
319
|
+
Description: Document classes and non-namespace modules.
|
320
|
+
Enabled: false
|
321
|
+
Style/DoubleNegation:
|
322
|
+
Description: Checks for uses of double negation (!!).
|
323
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
|
324
|
+
Enabled: false
|
325
|
+
Style/EachWithObject:
|
326
|
+
Description: Prefer `each_with_object` over `inject` or `reduce`.
|
327
|
+
Enabled: false
|
328
|
+
Style/EmptyElse:
|
329
|
+
Description: Avoid empty else-clauses.
|
330
|
+
Enabled: true
|
331
|
+
Style/EmptyLiteral:
|
332
|
+
Description: Prefer literals to Array.new/Hash.new/String.new.
|
333
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
|
334
|
+
Enabled: false
|
335
|
+
Layout/EndOfLine:
|
336
|
+
Description: Use Unix-style line endings.
|
337
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#crlf
|
338
|
+
Enabled: true
|
339
|
+
Style/EvenOdd:
|
340
|
+
Description: Favor the use of Fixnum#even? && Fixnum#odd?
|
341
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
|
342
|
+
Enabled: false
|
343
|
+
Lint/FlipFlop:
|
344
|
+
Description: Checks for flip flops
|
345
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-flip-flops
|
346
|
+
Enabled: false
|
347
|
+
Style/IfWithSemicolon:
|
348
|
+
Description: Do not use if x; .... Use the ternary operator instead.
|
349
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs
|
350
|
+
Enabled: false
|
351
|
+
Style/Lambda:
|
352
|
+
Description: Use the new lambda literal syntax for single-line blocks.
|
353
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#lambda-multi-line
|
354
|
+
Enabled: false
|
355
|
+
Style/LineEndConcatenation:
|
356
|
+
Description: Use \ instead of + or << to concatenate two string literals at line
|
357
|
+
end.
|
358
|
+
Enabled: false
|
359
|
+
Style/ModuleFunction:
|
360
|
+
Description: Checks for usage of `extend self` in modules.
|
361
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
|
362
|
+
Enabled: false
|
363
|
+
Style/MultilineBlockChain:
|
364
|
+
Description: Avoid multi-line chains of blocks.
|
365
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#single-line-blocks
|
366
|
+
Enabled: false
|
367
|
+
Layout/MultilineBlockLayout:
|
368
|
+
Description: Ensures newlines after multiline block do statements.
|
369
|
+
Enabled: false
|
370
|
+
Style/NegatedIf:
|
371
|
+
Description: Favor unless over if for negative conditions (or control flow or).
|
372
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#unless-for-negatives
|
373
|
+
Enabled: false
|
374
|
+
Style/NegatedWhile:
|
375
|
+
Description: Favor until over while for negative conditions.
|
376
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#until-for-negatives
|
377
|
+
Enabled: false
|
378
|
+
Style/NilComparison:
|
379
|
+
Description: Prefer x.nil? to x == nil.
|
380
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
|
381
|
+
Enabled: false
|
382
|
+
Style/OneLineConditional:
|
383
|
+
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
384
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
|
385
|
+
Enabled: false
|
386
|
+
Naming/BinaryOperatorParameterName:
|
387
|
+
Description: When defining binary operators, name the argument other.
|
388
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#other-arg
|
389
|
+
Enabled: false
|
390
|
+
Style/PerlBackrefs:
|
391
|
+
Description: Avoid Perl-style regex back references.
|
392
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
|
393
|
+
Enabled: false
|
394
|
+
Style/Proc:
|
395
|
+
Description: Use proc instead of Proc.new.
|
396
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc
|
397
|
+
Enabled: false
|
398
|
+
Style/SelfAssignment:
|
399
|
+
Description: Checks for places where self-assignment shorthand should have been
|
400
|
+
used.
|
401
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#self-assignment
|
402
|
+
Enabled: false
|
403
|
+
Layout/SpaceBeforeFirstArg:
|
404
|
+
Description: Put a space between a method name and the first argument in a method
|
405
|
+
call without parentheses.
|
406
|
+
Enabled: true
|
407
|
+
Layout/SpaceAroundOperators:
|
408
|
+
Description: Use spaces around operators.
|
409
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
|
410
|
+
Enabled: true
|
411
|
+
Layout/SpaceInsideParens:
|
412
|
+
Description: No spaces after ( or before ).
|
413
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-spaces-braces
|
414
|
+
Enabled: true
|
415
|
+
Style/SpecialGlobalVars:
|
416
|
+
Description: Avoid Perl-style global variables.
|
417
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
|
418
|
+
Enabled: false
|
419
|
+
Style/VariableInterpolation:
|
420
|
+
Description: Don't interpolate global, instance and class variables directly in
|
421
|
+
strings.
|
422
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
|
423
|
+
Enabled: false
|
424
|
+
Style/WhenThen:
|
425
|
+
Description: Use when x then ... for one-line cases.
|
426
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
|
427
|
+
Enabled: false
|
428
|
+
Lint/AmbiguousOperator:
|
429
|
+
Description: Checks for ambiguous operators in the first argument of a method invocation
|
430
|
+
without parentheses.
|
431
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-as-args
|
432
|
+
Enabled: false
|
433
|
+
Lint/AmbiguousRegexpLiteral:
|
434
|
+
Description: Checks for ambiguous regexp literals in the first argument of a method
|
435
|
+
invocation without parenthesis.
|
436
|
+
Enabled: false
|
437
|
+
Layout/BlockAlignment:
|
438
|
+
Description: Align block ends correctly.
|
439
|
+
Enabled: true
|
440
|
+
Layout/ConditionPosition:
|
441
|
+
Description: Checks for condition placed in a confusing position relative to the
|
442
|
+
keyword.
|
443
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#same-line-condition
|
444
|
+
Enabled: false
|
445
|
+
Lint/DeprecatedClassMethods:
|
446
|
+
Description: Check for deprecated class method calls.
|
447
|
+
Enabled: false
|
448
|
+
Lint/ElseLayout:
|
449
|
+
Description: Check for odd code arrangement in an else block.
|
450
|
+
Enabled: false
|
451
|
+
Lint/SuppressedException:
|
452
|
+
Description: Don't suppress exception.
|
453
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
|
454
|
+
Enabled: false
|
455
|
+
Lint/LiteralAsCondition:
|
456
|
+
Description: Checks of literals used in conditions.
|
457
|
+
Enabled: false
|
458
|
+
Lint/LiteralInInterpolation:
|
459
|
+
Description: Checks for literals used in interpolation.
|
460
|
+
Enabled: false
|
461
|
+
Lint/Loop:
|
462
|
+
Description: Use Kernel#loop with break rather than begin/end/until or begin/end/while
|
463
|
+
for post-loop tests.
|
464
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#loop-with-break
|
465
|
+
Enabled: false
|
466
|
+
Lint/ParenthesesAsGroupedExpression:
|
467
|
+
Description: Checks for method calls with a space before the opening parenthesis.
|
468
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-no-spaces
|
469
|
+
Enabled: false
|
470
|
+
Lint/RequireParentheses:
|
471
|
+
Description: Use parentheses in the method call to avoid confusion about precedence.
|
472
|
+
Enabled: false
|
473
|
+
Lint/UnderscorePrefixedVariableName:
|
474
|
+
Description: Do not use prefix `_` for a variable that is used.
|
475
|
+
Enabled: false
|
476
|
+
Lint/Void:
|
477
|
+
Description: Possible use of operator/literal/variable in void context.
|
478
|
+
Enabled: false
|
479
|
+
Lint/RaiseException:
|
480
|
+
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
481
|
+
Enabled: true
|
482
|
+
Lint/StructNewOverride:
|
483
|
+
Description: Disallow overriding the `Struct` built-in methods via `Struct.new`.
|
484
|
+
Enabled: true
|
485
|
+
Style/OptionalBooleanParameter:
|
486
|
+
Description: 'Use keyword arguments when defining method with boolean argument.'
|
487
|
+
Enabled: false
|
488
|
+
Lint/MissingSuper:
|
489
|
+
Description: >-
|
490
|
+
This cop checks for the presence of constructors and lifecycle callbacks
|
491
|
+
without calls to `super`'.
|
492
|
+
Enabled: false
|
493
|
+
Style/RedundantFileExtensionInRequire:
|
494
|
+
Description: >-
|
495
|
+
Checks for the presence of superfluous `.rb` extension in
|
496
|
+
the filename provided to `require` and `require_relative`.
|
497
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at benjaminearle123@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rubocop-platanus (0.1.0)
|
5
|
+
rubocop (>= 0.89.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.2)
|
11
|
+
coderay (1.1.3)
|
12
|
+
coveralls (0.8.23)
|
13
|
+
json (>= 1.8, < 3)
|
14
|
+
simplecov (~> 0.16.1)
|
15
|
+
term-ansicolor (~> 1.3)
|
16
|
+
thor (>= 0.19.4, < 2.0)
|
17
|
+
tins (~> 1.6)
|
18
|
+
diff-lcs (1.5.0)
|
19
|
+
docile (1.4.0)
|
20
|
+
ffi (1.15.5)
|
21
|
+
formatador (1.1.0)
|
22
|
+
guard (2.18.0)
|
23
|
+
formatador (>= 0.2.4)
|
24
|
+
listen (>= 2.7, < 4.0)
|
25
|
+
lumberjack (>= 1.0.12, < 2.0)
|
26
|
+
nenv (~> 0.1)
|
27
|
+
notiffany (~> 0.0)
|
28
|
+
pry (>= 0.13.0)
|
29
|
+
shellany (~> 0.0)
|
30
|
+
thor (>= 0.18.1)
|
31
|
+
guard-compat (1.2.1)
|
32
|
+
guard-rspec (4.7.3)
|
33
|
+
guard (~> 2.1)
|
34
|
+
guard-compat (~> 1.1)
|
35
|
+
rspec (>= 2.99.0, < 4.0)
|
36
|
+
json (2.6.1)
|
37
|
+
listen (3.7.1)
|
38
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
39
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
40
|
+
lumberjack (1.2.8)
|
41
|
+
method_source (1.0.0)
|
42
|
+
nenv (0.3.0)
|
43
|
+
notiffany (0.1.3)
|
44
|
+
nenv (~> 0.1)
|
45
|
+
shellany (~> 0.0)
|
46
|
+
parallel (1.22.1)
|
47
|
+
parser (3.1.2.0)
|
48
|
+
ast (~> 2.4.1)
|
49
|
+
pry (0.14.1)
|
50
|
+
coderay (~> 1.1)
|
51
|
+
method_source (~> 1.0)
|
52
|
+
rainbow (3.1.1)
|
53
|
+
rake (13.0.6)
|
54
|
+
rb-fsevent (0.11.1)
|
55
|
+
rb-inotify (0.10.1)
|
56
|
+
ffi (~> 1.0)
|
57
|
+
regexp_parser (2.3.0)
|
58
|
+
rexml (3.2.5)
|
59
|
+
rspec (3.11.0)
|
60
|
+
rspec-core (~> 3.11.0)
|
61
|
+
rspec-expectations (~> 3.11.0)
|
62
|
+
rspec-mocks (~> 3.11.0)
|
63
|
+
rspec-core (3.11.0)
|
64
|
+
rspec-support (~> 3.11.0)
|
65
|
+
rspec-expectations (3.11.0)
|
66
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
+
rspec-support (~> 3.11.0)
|
68
|
+
rspec-mocks (3.11.1)
|
69
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
70
|
+
rspec-support (~> 3.11.0)
|
71
|
+
rspec-support (3.11.0)
|
72
|
+
rspec_junit_formatter (0.5.1)
|
73
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
74
|
+
rubocop (1.27.0)
|
75
|
+
parallel (~> 1.10)
|
76
|
+
parser (>= 3.1.0.0)
|
77
|
+
rainbow (>= 2.2.2, < 4.0)
|
78
|
+
regexp_parser (>= 1.8, < 3.0)
|
79
|
+
rexml
|
80
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
81
|
+
ruby-progressbar (~> 1.7)
|
82
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
83
|
+
rubocop-ast (1.17.0)
|
84
|
+
parser (>= 3.1.1.0)
|
85
|
+
ruby-progressbar (1.11.0)
|
86
|
+
shellany (0.0.1)
|
87
|
+
simplecov (0.16.1)
|
88
|
+
docile (~> 1.1)
|
89
|
+
json (>= 1.8, < 3)
|
90
|
+
simplecov-html (~> 0.10.0)
|
91
|
+
simplecov-html (0.10.2)
|
92
|
+
sync (0.5.0)
|
93
|
+
term-ansicolor (1.7.1)
|
94
|
+
tins (~> 1.0)
|
95
|
+
thor (1.2.1)
|
96
|
+
tins (1.31.0)
|
97
|
+
sync
|
98
|
+
unicode-display_width (2.1.0)
|
99
|
+
|
100
|
+
PLATFORMS
|
101
|
+
x86_64-linux
|
102
|
+
|
103
|
+
DEPENDENCIES
|
104
|
+
bundler (~> 2.3.11)
|
105
|
+
coveralls
|
106
|
+
guard-rspec
|
107
|
+
pry
|
108
|
+
rake (~> 13.0)
|
109
|
+
rspec (~> 3.0)
|
110
|
+
rspec_junit_formatter
|
111
|
+
rubocop (~> 1.21)
|
112
|
+
rubocop-platanus!
|
113
|
+
|
114
|
+
BUNDLED WITH
|
115
|
+
2.3.11
|
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright 2022 Platanus
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# Test Gem
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rubocop-platanus.svg)](https://badge.fury.io/rb/rubocop-platanus)
|
4
|
+
[![CircleCI](https://circleci.com/gh/platanus/rubocop-platanus.svg?style=shield)](https://app.circleci.com/pipelines/github/platanus/rubocop-platanus)
|
5
|
+
|
6
|
+
A RuboCop extension for enforcing [Platanus](https://github.com/platanus) best practices and code style.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
```bash
|
11
|
+
gem install rubocop-platanus
|
12
|
+
```
|
13
|
+
|
14
|
+
Or add to your Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem "rubocop-platanus"
|
18
|
+
```
|
19
|
+
|
20
|
+
```bash
|
21
|
+
bundle install
|
22
|
+
```
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
You need to tell RuboCop to load the Platanus extension. There are three ways to do this:
|
27
|
+
|
28
|
+
### RuboCop configuration file
|
29
|
+
|
30
|
+
Put this into your .rubocop.yml.
|
31
|
+
|
32
|
+
```yaml
|
33
|
+
require: rubocop-platanus
|
34
|
+
```
|
35
|
+
|
36
|
+
Alternatively, use the following array notation when specifying multiple extensions.
|
37
|
+
|
38
|
+
```yaml
|
39
|
+
require:
|
40
|
+
- rubocop-other-extension
|
41
|
+
- rubocop-platanus
|
42
|
+
```
|
43
|
+
|
44
|
+
Now you can run rubocop and it will automatically load the RuboCop Platanus cops together with the standard cops.
|
45
|
+
|
46
|
+
### Command line
|
47
|
+
|
48
|
+
```bash
|
49
|
+
rubocop --require rubocop-platanus
|
50
|
+
```
|
51
|
+
|
52
|
+
## Testing
|
53
|
+
|
54
|
+
To run the specs you need to execute, **in the root path of the gem**, the following command:
|
55
|
+
|
56
|
+
```bash
|
57
|
+
bundle exec guard
|
58
|
+
```
|
59
|
+
|
60
|
+
You need to put **all your tests** in the `/my_gem/spec/` directory.
|
61
|
+
|
62
|
+
## Development
|
63
|
+
|
64
|
+
To create a new cop, you need to execute, **in the root path of the gem**, the following command:
|
65
|
+
|
66
|
+
```bash
|
67
|
+
$ bundle exec rake 'new_cop[Foobar/SuperCoolCopName]'
|
68
|
+
[create] lib/rubocop/cop/foobar/super_cool_name.rb
|
69
|
+
[create] spec/rubocop/cop/foobar/super_cool_name.rb
|
70
|
+
[modify] lib/rubocop/cop/potassium_cops.rb - `require_relative 'foobar/super_cool_name'` was injected.
|
71
|
+
[modify] A configuration for the cop is added into config/default.yml.
|
72
|
+
Do 4 steps:
|
73
|
+
1. Modify the description of Foobar/SuperCoolCopName in config/default.yml
|
74
|
+
2. Implement your new cop in the generated file!
|
75
|
+
3. Commit your new cop with a message such as
|
76
|
+
e.g. "Add new `Foobar/SuperCoolCopName` cop"
|
77
|
+
4. Run `bundle exec rake changelog:new` to generate a changelog entry
|
78
|
+
for your new cop.
|
79
|
+
```
|
80
|
+
|
81
|
+
## Publishing
|
82
|
+
|
83
|
+
On master/main branch...
|
84
|
+
|
85
|
+
1. Change `VERSION` in `lib/rubocop-platanus/version.rb`.
|
86
|
+
2. Change `Unreleased` title to current version in `CHANGELOG.md`.
|
87
|
+
3. Run `bundle install`.
|
88
|
+
4. Commit new release. For example: `Releasing v0.1.0`.
|
89
|
+
5. Create tag. For example: `git tag v0.1.0`.
|
90
|
+
6. Push tag. For example: `git push origin v0.1.0`.
|
91
|
+
|
92
|
+
## Contributing
|
93
|
+
|
94
|
+
1. Fork it
|
95
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
96
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
97
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
98
|
+
5. Create new Pull Request
|
99
|
+
|
100
|
+
## Credits
|
101
|
+
|
102
|
+
Thank you [contributors](https://github.com/platanus/rubocop-platanus/graphs/contributors)!
|
103
|
+
|
104
|
+
<img src="http://platan.us/gravatar_with_text.png" alt="Platanus" width="250"/>
|
105
|
+
|
106
|
+
Test Gem is maintained by [platanus](http://platan.us).
|
107
|
+
|
108
|
+
## License
|
109
|
+
|
110
|
+
Test Gem is © 2022 platanus, spa. It is free software and may be redistributed under the terms specified in the LICENSE file.
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
require "rubocop/rake_task"
|
9
|
+
|
10
|
+
RuboCop::RakeTask.new
|
11
|
+
|
12
|
+
task default: %i[spec rubocop]
|
13
|
+
|
14
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
15
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Generate a new cop with a template'
|
19
|
+
task :new_cop, [:cop] do |_task, args|
|
20
|
+
require 'rubocop'
|
21
|
+
|
22
|
+
cop_name = args.fetch(:cop) do
|
23
|
+
warn 'usage: bundle exec rake new_cop[Department/Name]'
|
24
|
+
exit!
|
25
|
+
end
|
26
|
+
|
27
|
+
generator = RuboCop::Cop::Generator.new(cop_name)
|
28
|
+
|
29
|
+
generator.write_source
|
30
|
+
generator.write_spec
|
31
|
+
generator.inject_require(root_file_path: 'lib/rubocop/cop/platanus_cops.rb')
|
32
|
+
generator.inject_config(config_file_path: 'config/default.yml')
|
33
|
+
|
34
|
+
puts generator.todo
|
35
|
+
end
|
data/config/default.yml
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Platanus
|
6
|
+
# Usage of PowerTypes::Command is no longer recommended. Rails
|
7
|
+
# ApplicationJob should be used instead.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
#
|
11
|
+
# # bad
|
12
|
+
# class ExecuteSomeAction < PowerTypes::Command.new(:foo, :bar)
|
13
|
+
# def perform
|
14
|
+
# # Command code goes here
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# # good
|
19
|
+
# class GuestsCleanupJob < ApplicationJob
|
20
|
+
# def perform
|
21
|
+
# # Job code goes here
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
class NoCommand < Base
|
26
|
+
MSG = 'Use `ApplicationJob` instead of `PowerTypes::Command`.'
|
27
|
+
|
28
|
+
# @!method uses_powertypes_command?(node)
|
29
|
+
def_node_matcher :uses_powertypes_command?, <<~PATTERN
|
30
|
+
(class _ (send (const (const _ :PowerTypes) :Command) :new ...) _)
|
31
|
+
PATTERN
|
32
|
+
|
33
|
+
def on_class(node)
|
34
|
+
return unless uses_powertypes_command?(node)
|
35
|
+
|
36
|
+
add_offense(node)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The original code is from https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
|
4
|
+
# See https://github.com/rubocop/rubocop-rspec/blob/master/MIT-LICENSE.md
|
5
|
+
module RuboCop
|
6
|
+
module Platanus
|
7
|
+
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
8
|
+
# bit of our configuration.
|
9
|
+
module Inject
|
10
|
+
def self.defaults!
|
11
|
+
path = CONFIG_DEFAULT.to_s
|
12
|
+
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
13
|
+
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
14
|
+
puts "configuration from #{path}" if ConfigLoader.debug?
|
15
|
+
config = ConfigLoader.merge_with_default(config, path)
|
16
|
+
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "platanus/version"
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Platanus
|
7
|
+
class Error < StandardError; end
|
8
|
+
# Your code goes here...
|
9
|
+
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
10
|
+
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
11
|
+
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
12
|
+
|
13
|
+
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubocop'
|
4
|
+
|
5
|
+
require_relative 'rubocop/platanus'
|
6
|
+
require_relative 'rubocop/platanus/version'
|
7
|
+
require_relative 'rubocop/platanus/inject'
|
8
|
+
|
9
|
+
RuboCop::Platanus::Inject.defaults!
|
10
|
+
|
11
|
+
require_relative 'rubocop/cop/platanus_cops'
|
metadata
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubocop-platanus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Platanus
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-04-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.3.11
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.3.11
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coveralls
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec_junit_formatter
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.9'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.9'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.89.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.89.0
|
139
|
+
description: A RuboCop extension for enforcing Platanus best practices and code style.
|
140
|
+
email:
|
141
|
+
- rubygems@platan.us
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".editorconfig"
|
147
|
+
- ".rspec"
|
148
|
+
- ".rubocop.yml"
|
149
|
+
- ".ruby-version"
|
150
|
+
- CHANGELOG.md
|
151
|
+
- CODE_OF_CONDUCT.md
|
152
|
+
- Gemfile
|
153
|
+
- Gemfile.lock
|
154
|
+
- Guardfile
|
155
|
+
- LICENSE.txt
|
156
|
+
- README.md
|
157
|
+
- Rakefile
|
158
|
+
- config/default.yml
|
159
|
+
- lib/rubocop-platanus.rb
|
160
|
+
- lib/rubocop/cop/platanus/no_command.rb
|
161
|
+
- lib/rubocop/cop/platanus_cops.rb
|
162
|
+
- lib/rubocop/platanus.rb
|
163
|
+
- lib/rubocop/platanus/inject.rb
|
164
|
+
- lib/rubocop/platanus/version.rb
|
165
|
+
- sig/rubocop/platanus.rbs
|
166
|
+
homepage: https://github.com/platanus/rubocop-platanus
|
167
|
+
licenses:
|
168
|
+
- MIT
|
169
|
+
metadata: {}
|
170
|
+
post_install_message:
|
171
|
+
rdoc_options: []
|
172
|
+
require_paths:
|
173
|
+
- lib
|
174
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: 2.7.0
|
179
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
requirements: []
|
185
|
+
rubygems_version: 3.1.6
|
186
|
+
signing_key:
|
187
|
+
specification_version: 4
|
188
|
+
summary: A code checking and style enforcing tool.
|
189
|
+
test_files: []
|