rubocop-katalyst 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.circleci/config.yml +13 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +6 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +89 -0
- data/LICENSE.txt +21 -0
- data/README.md +58 -0
- data/Rakefile +38 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/config/default.yml +44 -0
- data/config/rubocop-bundler.yml +2 -0
- data/config/rubocop-gemspec.yml +2 -0
- data/config/rubocop-layout.yml +51 -0
- data/config/rubocop-lint.yml +106 -0
- data/config/rubocop-metrics.yml +45 -0
- data/config/rubocop-naming.yml +29 -0
- data/config/rubocop-performance.yml +50 -0
- data/config/rubocop-rails.yml +61 -0
- data/config/rubocop-rake.yml +2 -0
- data/config/rubocop-rspec.yml +6 -0
- data/config/rubocop-security.yml +2 -0
- data/config/rubocop-style.yml +325 -0
- data/lib/rubocop/cop/katalyst_cops.rb +7 -0
- data/lib/rubocop/katalyst/inject.rb +22 -0
- data/lib/rubocop/katalyst/version.rb +7 -0
- data/lib/rubocop/katalyst.rb +15 -0
- data/lib/rubocop-katalyst.rb +15 -0
- data/rubocop-katalyst.gemspec +43 -0
- metadata +149 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
# Naming configuration overrides
|
2
|
+
# https://docs.rubocop.org/rubocop/1.5/cops_lint.html
|
3
|
+
|
4
|
+
Naming/AccessorMethodName:
|
5
|
+
Description: Check the naming of accessor methods for get_/set_.
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Naming/AsciiIdentifiers:
|
9
|
+
Description: 'Use only ascii symbols in identifiers.'
|
10
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#english-identifiers'
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Naming/BinaryOperatorParameterName:
|
14
|
+
Description: 'When defining binary operators, name the argument other.'
|
15
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#other-arg'
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Naming/FileName:
|
19
|
+
Description: 'Use snake_case for source file names.'
|
20
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#snake-case-files'
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Naming/PredicateName:
|
24
|
+
Description: 'Check the names of predicate methods.'
|
25
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#bool-methods-qmark'
|
26
|
+
ForbiddenPrefixes:
|
27
|
+
- is_
|
28
|
+
Exclude:
|
29
|
+
- spec/**/*
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# RuboCop Performance extension configuration overrides
|
2
|
+
# https://github.com/rubocop/rubocop-performance
|
3
|
+
|
4
|
+
Performance/CaseWhenSplat:
|
5
|
+
Description: >-
|
6
|
+
Place `when` conditions that use splat at the end
|
7
|
+
of the list of `when` branches.
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Performance/Count:
|
11
|
+
Description: >-
|
12
|
+
Use `count` instead of `select...size`, `reject...size`,
|
13
|
+
`select...count`, `reject...count`, `select...length`,
|
14
|
+
and `reject...length`.
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Performance/Detect:
|
18
|
+
Description: >-
|
19
|
+
Use `detect` instead of `select.first`, `find_all.first`,
|
20
|
+
`select.last`, and `find_all.last`.
|
21
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Performance/FlatMap:
|
25
|
+
Description: >-
|
26
|
+
Use `Enumerable#flat_map`
|
27
|
+
instead of `Enumerable#map...Array#flatten(1)`
|
28
|
+
or `Enumberable#collect..Array#flatten(1)`
|
29
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Performance/ReverseEach:
|
33
|
+
Description: 'Use `reverse_each` instead of `reverse.each`.'
|
34
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Performance/Size:
|
38
|
+
Description: >-
|
39
|
+
Use `size` instead of `count` for counting
|
40
|
+
the number of elements in `Array` and `Hash`.
|
41
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Performance/StringReplacement:
|
45
|
+
Description: >-
|
46
|
+
Use `tr` instead of `gsub` when you are replacing the same
|
47
|
+
number of characters. Use `delete` instead of `gsub` when
|
48
|
+
you are deleting characters.
|
49
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
50
|
+
Enabled: false
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# RuboCop Rails extension configuration overrides
|
2
|
+
# https://github.com/rubocop/rubocop-rails
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
Exclude:
|
6
|
+
- bin/*
|
7
|
+
- db/schema.rb
|
8
|
+
- vendor/bundle/**/*
|
9
|
+
|
10
|
+
Rails:
|
11
|
+
TargetRailsVersion: ">= 6.0"
|
12
|
+
|
13
|
+
Rails/ActionFilter:
|
14
|
+
Description: 'Enforces consistent use of action filter methods.'
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Rails/Date:
|
18
|
+
Description: >-
|
19
|
+
Checks the correct usage of date aware methods,
|
20
|
+
such as Date.today, Date.current etc.
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
Rails/Delegate:
|
24
|
+
Description: 'Prefer delegate method for delegations.'
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Rails/FindBy:
|
28
|
+
Description: 'Prefer find_by over where.first.'
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Rails/FindEach:
|
32
|
+
Description: 'Prefer all.find_each over all.find.'
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Rails/HasAndBelongsToMany:
|
36
|
+
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Rails/Output:
|
40
|
+
Description: 'Checks for calls to puts, print, etc.'
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Rails/ReadWriteAttribute:
|
44
|
+
Description: >-
|
45
|
+
Checks for read_attribute(:attr) and
|
46
|
+
write_attribute(:attr, val).
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Rails/ScopeArgs:
|
50
|
+
Description: 'Checks the arguments of ActiveRecord scopes.'
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Rails/TimeZone:
|
54
|
+
Description: 'Checks the correct usage of time zone aware methods.'
|
55
|
+
StyleGuide: 'https://github.com/rubocop/rails-style-guide#time'
|
56
|
+
Reference: 'https://danilenko.org/2012/7/6/rails_timezones'
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
Rails/Validation:
|
60
|
+
Description: 'Use validates :attribute, hash of validations.'
|
61
|
+
Enabled: false
|
@@ -0,0 +1,325 @@
|
|
1
|
+
# Style configuration overrides
|
2
|
+
# https://docs.rubocop.org/rubocop/1.5/cops_style.html
|
3
|
+
|
4
|
+
Style/Alias:
|
5
|
+
Description: 'Use alias_method instead of alias.'
|
6
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#alias-method'
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Style/ArrayJoin:
|
10
|
+
Description: 'Use Array#join instead of Array#*.'
|
11
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#array-join'
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Style/AsciiComments:
|
15
|
+
Description: 'Use only ascii symbols in comments.'
|
16
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#english-comments'
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Style/Attr:
|
20
|
+
Description: 'Checks for uses of Module#attr.'
|
21
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#attr'
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/CaseEquality:
|
25
|
+
Description: 'Avoid explicit use of the case equality operator(===).'
|
26
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-case-equality'
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/CharacterLiteral:
|
30
|
+
Description: 'Checks for uses of character literals.'
|
31
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-character-literals'
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/ClassAndModuleChildren:
|
35
|
+
Description: 'Checks style of children classes and modules.'
|
36
|
+
Enabled: true
|
37
|
+
EnforcedStyle: nested
|
38
|
+
|
39
|
+
Style/ClassVars:
|
40
|
+
Description: 'Avoid the use of class variables.'
|
41
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-class-vars'
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Style/CollectionMethods:
|
45
|
+
Enabled: true
|
46
|
+
PreferredMethods:
|
47
|
+
find: detect
|
48
|
+
inject: reduce
|
49
|
+
collect: map
|
50
|
+
find_all: select
|
51
|
+
|
52
|
+
Style/ColonMethodCall:
|
53
|
+
Description: 'Do not use :: for method call.'
|
54
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#double-colons'
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/CommentAnnotation:
|
58
|
+
Description: >-
|
59
|
+
Checks formatting of special comments
|
60
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
61
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#annotate-keywords'
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
Style/PreferredHashMethods:
|
65
|
+
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
66
|
+
StyleGuide: '#hash-key'
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Style/Documentation:
|
70
|
+
Description: 'Document classes and non-namespace modules.'
|
71
|
+
Enabled: false
|
72
|
+
|
73
|
+
Style/DoubleNegation:
|
74
|
+
Description: 'Checks for uses of double negation (!!).'
|
75
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-bang-bang'
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
Style/EachWithObject:
|
79
|
+
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
|
80
|
+
Enabled: false
|
81
|
+
|
82
|
+
Style/EmptyLiteral:
|
83
|
+
Description: 'Prefer literals to Array.new/Hash.new/String.new.'
|
84
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#literal-array-hash'
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
# Checks whether the source file has a utf-8 encoding comment or not
|
88
|
+
# AutoCorrectEncodingComment must match the regex
|
89
|
+
# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
|
90
|
+
Style/Encoding:
|
91
|
+
Enabled: false
|
92
|
+
|
93
|
+
Style/EvenOdd:
|
94
|
+
Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
|
95
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#predicate-methods'
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
Style/FrozenStringLiteralComment:
|
99
|
+
Description: >-
|
100
|
+
Add the frozen_string_literal comment to the top of files
|
101
|
+
to help transition from Ruby 2.3.0 to Ruby 3.0.
|
102
|
+
Enabled: true
|
103
|
+
|
104
|
+
Style/FormatString:
|
105
|
+
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
106
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#sprintf'
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
Style/GlobalVars:
|
110
|
+
Description: 'Do not introduce global variables.'
|
111
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#instance-vars'
|
112
|
+
Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
|
113
|
+
Enabled: false
|
114
|
+
|
115
|
+
Style/GuardClause:
|
116
|
+
Description: 'Check for conditionals that can be replaced with guard clauses'
|
117
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-nested-conditionals'
|
118
|
+
Enabled: false
|
119
|
+
|
120
|
+
Style/IfUnlessModifier:
|
121
|
+
Description: >-
|
122
|
+
Favor modifier if/unless usage when you have a
|
123
|
+
single-line body.
|
124
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#if-as-a-modifier'
|
125
|
+
Enabled: false
|
126
|
+
|
127
|
+
Style/IfWithSemicolon:
|
128
|
+
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
129
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-semicolon-ifs'
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
Style/InlineComment:
|
133
|
+
Description: 'Avoid inline comments.'
|
134
|
+
Enabled: false
|
135
|
+
|
136
|
+
Style/Lambda:
|
137
|
+
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
138
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#lambda-multi-line'
|
139
|
+
Enabled: false
|
140
|
+
|
141
|
+
Style/LambdaCall:
|
142
|
+
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
143
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#proc-call'
|
144
|
+
Enabled: false
|
145
|
+
|
146
|
+
Style/LineEndConcatenation:
|
147
|
+
Description: >-
|
148
|
+
Use \ instead of + or << to concatenate two string literals at
|
149
|
+
line end.
|
150
|
+
Enabled: false
|
151
|
+
|
152
|
+
Style/ModuleFunction:
|
153
|
+
Description: 'Checks for usage of `extend self` in modules.'
|
154
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#module-function'
|
155
|
+
Enabled: false
|
156
|
+
|
157
|
+
Style/MultilineBlockChain:
|
158
|
+
Description: 'Avoid multi-line chains of blocks.'
|
159
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#single-line-blocks'
|
160
|
+
Enabled: false
|
161
|
+
|
162
|
+
Style/NegatedIf:
|
163
|
+
Description: >-
|
164
|
+
Favor unless over if for negative conditions
|
165
|
+
(or control flow or).
|
166
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#unless-for-negatives'
|
167
|
+
Enabled: false
|
168
|
+
|
169
|
+
Style/NegatedWhile:
|
170
|
+
Description: 'Favor until over while for negative conditions.'
|
171
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#until-for-negatives'
|
172
|
+
Enabled: false
|
173
|
+
|
174
|
+
Style/Next:
|
175
|
+
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
176
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-nested-conditionals'
|
177
|
+
Enabled: false
|
178
|
+
|
179
|
+
Style/NilComparison:
|
180
|
+
Description: 'Prefer x.nil? to x == nil.'
|
181
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#predicate-methods'
|
182
|
+
Enabled: false
|
183
|
+
|
184
|
+
Style/Not:
|
185
|
+
Description: 'Use ! instead of not.'
|
186
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#bang-not-not'
|
187
|
+
Enabled: false
|
188
|
+
|
189
|
+
Style/NumericLiterals:
|
190
|
+
Description: >-
|
191
|
+
Add underscores to large numeric literals to improve their
|
192
|
+
readability.
|
193
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#underscores-in-numerics'
|
194
|
+
Enabled: false
|
195
|
+
|
196
|
+
Style/OneLineConditional:
|
197
|
+
Description: >-
|
198
|
+
Favor the ternary operator(?:) over
|
199
|
+
if/then/else/end constructs.
|
200
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#ternary-operator'
|
201
|
+
Enabled: false
|
202
|
+
|
203
|
+
Style/PercentLiteralDelimiters:
|
204
|
+
Description: 'Use `%`-literal delimiters consistently'
|
205
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#percent-literal-braces'
|
206
|
+
Enabled: false
|
207
|
+
|
208
|
+
Style/PerlBackrefs:
|
209
|
+
Description: 'Avoid Perl-style regex back references.'
|
210
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-perl-regexp-last-matchers'
|
211
|
+
Enabled: false
|
212
|
+
|
213
|
+
Style/Proc:
|
214
|
+
Description: 'Use proc instead of Proc.new.'
|
215
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#proc'
|
216
|
+
Enabled: false
|
217
|
+
|
218
|
+
Style/RaiseArgs:
|
219
|
+
Description: 'Checks the arguments passed to raise/fail.'
|
220
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#exception-class-messages'
|
221
|
+
Enabled: false
|
222
|
+
|
223
|
+
Style/RegexpLiteral:
|
224
|
+
Description: 'Use / or %r around regular expressions.'
|
225
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#percent-r'
|
226
|
+
Enabled: false
|
227
|
+
|
228
|
+
Style/Sample:
|
229
|
+
Description: >-
|
230
|
+
Use `sample` instead of `shuffle.first`,
|
231
|
+
`shuffle.last`, and `shuffle[Fixnum]`.
|
232
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
233
|
+
Enabled: false
|
234
|
+
|
235
|
+
Style/SelfAssignment:
|
236
|
+
Description: >-
|
237
|
+
Checks for places where self-assignment shorthand should have
|
238
|
+
been used.
|
239
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#self-assignment'
|
240
|
+
Enabled: false
|
241
|
+
|
242
|
+
Style/SingleLineBlockParams:
|
243
|
+
Description: 'Enforces the names of some block params.'
|
244
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#reduce-blocks'
|
245
|
+
Enabled: false
|
246
|
+
|
247
|
+
Style/SingleLineMethods:
|
248
|
+
Description: 'Avoid single-line methods.'
|
249
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-single-line-methods'
|
250
|
+
Enabled: false
|
251
|
+
|
252
|
+
Style/SignalException:
|
253
|
+
Description: 'Checks for proper usage of fail and raise.'
|
254
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#fail-method'
|
255
|
+
Enabled: false
|
256
|
+
|
257
|
+
Style/SpecialGlobalVars:
|
258
|
+
Description: 'Avoid Perl-style global variables.'
|
259
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-cryptic-perlisms'
|
260
|
+
Enabled: false
|
261
|
+
|
262
|
+
Style/StringLiterals:
|
263
|
+
Description: 'Checks if uses of quotes match the configured preference.'
|
264
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#consistent-string-literals'
|
265
|
+
EnforcedStyle: double_quotes
|
266
|
+
Enabled: true
|
267
|
+
|
268
|
+
Style/TrailingCommaInArguments:
|
269
|
+
Description: 'Checks for trailing comma in argument lists.'
|
270
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-trailing-array-commas'
|
271
|
+
EnforcedStyleForMultiline: comma
|
272
|
+
SupportedStylesForMultiline:
|
273
|
+
- comma
|
274
|
+
- consistent_comma
|
275
|
+
- no_comma
|
276
|
+
Enabled: true
|
277
|
+
|
278
|
+
Style/TrailingCommaInArrayLiteral:
|
279
|
+
Description: 'Checks for trailing comma in array literals.'
|
280
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-trailing-array-commas'
|
281
|
+
EnforcedStyleForMultiline: comma
|
282
|
+
SupportedStylesForMultiline:
|
283
|
+
- comma
|
284
|
+
- consistent_comma
|
285
|
+
- no_comma
|
286
|
+
Enabled: true
|
287
|
+
|
288
|
+
Style/TrailingCommaInHashLiteral:
|
289
|
+
Description: 'Checks for trailing comma in hash literals.'
|
290
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#no-trailing-array-commas'
|
291
|
+
EnforcedStyleForMultiline: comma
|
292
|
+
SupportedStylesForMultiline:
|
293
|
+
- comma
|
294
|
+
- consistent_comma
|
295
|
+
- no_comma
|
296
|
+
Enabled: true
|
297
|
+
|
298
|
+
Style/TrivialAccessors:
|
299
|
+
Description: 'Prefer attr_* methods to trivial readers/writers.'
|
300
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#attr_family'
|
301
|
+
Enabled: false
|
302
|
+
|
303
|
+
Style/VariableInterpolation:
|
304
|
+
Description: >-
|
305
|
+
Don't interpolate global, instance and class variables
|
306
|
+
directly in strings.
|
307
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#curlies-interpolate'
|
308
|
+
Enabled: false
|
309
|
+
|
310
|
+
Style/WhenThen:
|
311
|
+
Description: 'Use when x then ... for one-line cases.'
|
312
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#one-line-cases'
|
313
|
+
Enabled: false
|
314
|
+
|
315
|
+
Style/WhileUntilModifier:
|
316
|
+
Description: >-
|
317
|
+
Favor modifier while/until usage when you have a
|
318
|
+
single-line body.
|
319
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#while-as-a-modifier'
|
320
|
+
Enabled: false
|
321
|
+
|
322
|
+
Style/WordArray:
|
323
|
+
Description: 'Use %w or %W for arrays of words.'
|
324
|
+
StyleGuide: 'https://github.com/rubocop/ruby-style-guide#percent-w'
|
325
|
+
Enabled: false
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The original code is from https://github.com/rubocop-hq/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
|
4
|
+
# See https://github.com/rubocop-hq/rubocop-rspec/blob/master/MIT-LICENSE.md
|
5
|
+
module RuboCop
|
6
|
+
module Katalyst
|
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
|
+
project_root = Pathname.new(__dir__).parent.parent.parent.expand_path
|
12
|
+
config_default = project_root.join("config", "default.yml")
|
13
|
+
path = config_default.to_s
|
14
|
+
hash = ConfigLoader.send(:load_file, File.new(path))
|
15
|
+
config = RuboCop::Config.new(hash, path)
|
16
|
+
puts "configuration from #{path}" if ConfigLoader.debug?
|
17
|
+
config = ConfigLoader.merge_with_default(config, path)
|
18
|
+
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "katalyst/version"
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Katalyst
|
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,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubocop"
|
4
|
+
require "rubocop-performance"
|
5
|
+
require "rubocop-rails"
|
6
|
+
require "rubocop-rake"
|
7
|
+
require "rubocop-rspec"
|
8
|
+
|
9
|
+
require_relative "rubocop/katalyst"
|
10
|
+
require_relative "rubocop/katalyst/inject"
|
11
|
+
require_relative "rubocop/katalyst/version"
|
12
|
+
|
13
|
+
RuboCop::Katalyst::Inject.defaults!
|
14
|
+
|
15
|
+
require_relative "rubocop/cop/katalyst_cops"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/rubocop/katalyst/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rubocop-katalyst"
|
7
|
+
spec.version = RuboCop::Katalyst::VERSION
|
8
|
+
spec.authors = ["Matt Redmond"]
|
9
|
+
spec.email = ["matt.redmond@katalyst.com.au"]
|
10
|
+
|
11
|
+
spec.summary = "Code standards for Katalyst"
|
12
|
+
spec.description = "Custom RuboCop for the Katalyst styleguide"
|
13
|
+
spec.homepage = "https://github.com/katalyst/rubocop-katalyst"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
16
|
+
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/katalyst/rubocop-katalyst"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/katalyst/rubocop-katalyst/changelog.md"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|\.rubocop)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
# Uncomment to register a new dependency of your gem
|
33
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
34
|
+
|
35
|
+
# For more information and examples about making a new gem, checkout our
|
36
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
37
|
+
|
38
|
+
spec.add_runtime_dependency "rubocop"
|
39
|
+
spec.add_runtime_dependency "rubocop-performance"
|
40
|
+
spec.add_runtime_dependency "rubocop-rails"
|
41
|
+
spec.add_runtime_dependency "rubocop-rake"
|
42
|
+
spec.add_runtime_dependency "rubocop-rspec"
|
43
|
+
end
|