rubocop-hk 1.0.9
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/README.md +3732 -0
- data/STYLEGUIDE.md +1660 -0
- data/config/default.yml +59 -0
- data/config/rubocop-layout.yml +215 -0
- data/config/rubocop-lint.yml +43 -0
- data/config/rubocop-metrics.yml +14 -0
- data/config/rubocop-performance.yml +33 -0
- data/config/rubocop-rails.yml +374 -0
- data/config/rubocop-rspec.yml +29 -0
- data/config/rubocop-style.yml +197 -0
- data/lib/rubocop/hk/command.rb +27 -0
- data/lib/rubocop/hk/version.rb +7 -0
- data/lib/rubocop/hk.rb +9 -0
- metadata +126 -0
@@ -0,0 +1,374 @@
|
|
1
|
+
# Rails 6-8.x Configuration - Modern Best Practices for 2025
|
2
|
+
# Optimized for Rails 6.0-8.0+ applications with backward compatibility
|
3
|
+
|
4
|
+
# ==========================================
|
5
|
+
# Core Rails Cops - Compatible with Rails 6-8.x
|
6
|
+
# ==========================================
|
7
|
+
|
8
|
+
Rails/ActionControllerFlashBeforeRender:
|
9
|
+
Description: Checks for calls to flash before render in controller actions
|
10
|
+
Enabled: true
|
11
|
+
|
12
|
+
Rails/ActionControllerTestCase:
|
13
|
+
Description: Use ActionDispatch::IntegrationTest instead of ActionController::TestCase
|
14
|
+
Enabled: true
|
15
|
+
|
16
|
+
Rails/ActiveRecordAliases:
|
17
|
+
Description: Avoid deprecated ActiveRecord aliases
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
Rails/ActiveRecordCallbacksOrder:
|
21
|
+
Description: Enforce consistent ordering of ActiveRecord callbacks
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Rails/ActiveSupportAliases:
|
25
|
+
Description: Avoid deprecated ActiveSupport aliases
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
Rails/ApplicationController:
|
29
|
+
Description: Controllers should inherit from ApplicationController
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
Rails/ApplicationRecord:
|
33
|
+
Description: Models should inherit from ApplicationRecord
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
Rails/BelongsTo:
|
37
|
+
Description: Use belongs_to associations correctly
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
Rails/BulkChangeTable:
|
41
|
+
Description: Use change_table with bulk operations for multiple column changes
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
Rails/CreateTableWithTimestamps:
|
45
|
+
Description: Always add timestamps to new tables
|
46
|
+
Enabled: true
|
47
|
+
|
48
|
+
Rails/Date:
|
49
|
+
Description: Use Rails time zone methods instead of Date methods
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
Rails/DefaultScope:
|
53
|
+
Description: Avoid using default_scope in ActiveRecord models
|
54
|
+
Enabled: true
|
55
|
+
Severity: warning
|
56
|
+
|
57
|
+
Rails/Delegate:
|
58
|
+
Description: Prefer delegate method for object delegation
|
59
|
+
Enabled: true
|
60
|
+
EnforceForPrefixed: true
|
61
|
+
|
62
|
+
Rails/DynamicFindBy:
|
63
|
+
Description: Use find_by instead of dynamic finders
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Rails/EnumHash:
|
67
|
+
Description: Use hash syntax for enums instead of array syntax
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Rails/EnumUniqueness:
|
71
|
+
Description: Ensure enum values are unique
|
72
|
+
Enabled: true
|
73
|
+
|
74
|
+
Rails/EnvironmentComparison:
|
75
|
+
Description: Prefer Rails.env methods over string comparisons
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Rails/Exit:
|
79
|
+
Description: Favor exit! in Rails applications
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
Rails/FilePath:
|
83
|
+
Description: Use Rails.root.join for file path construction
|
84
|
+
Enabled: true
|
85
|
+
EnforcedStyle: arguments
|
86
|
+
|
87
|
+
Rails/FindBy:
|
88
|
+
Description: Prefer find_by over where.first
|
89
|
+
Enabled: true
|
90
|
+
|
91
|
+
Rails/FindEach:
|
92
|
+
Description: Use find_each instead of each for large datasets
|
93
|
+
Enabled: true
|
94
|
+
|
95
|
+
Rails/HasAndBelongsToMany:
|
96
|
+
Description: Prefer has_many :through over has_and_belongs_to_many
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
Rails/HasManyOrHasOneDependent:
|
100
|
+
Description: Always specify dependent option for has_many/has_one associations
|
101
|
+
Enabled: true
|
102
|
+
|
103
|
+
Rails/HelperInstanceVariable:
|
104
|
+
Description: Avoid instance variables in helpers
|
105
|
+
Enabled: true
|
106
|
+
|
107
|
+
Rails/HttpPositionalArguments:
|
108
|
+
Description: Use keyword arguments for HTTP request methods in tests
|
109
|
+
Enabled: true
|
110
|
+
|
111
|
+
Rails/HttpStatus:
|
112
|
+
Description: Use symbolic HTTP status codes
|
113
|
+
Enabled: true
|
114
|
+
EnforcedStyle: symbolic
|
115
|
+
|
116
|
+
Rails/I18nLocaleTexts:
|
117
|
+
Description: Move locale texts to locale files
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
Rails/IndexBy:
|
121
|
+
Description: Use index_by instead of manually building hashes
|
122
|
+
Enabled: true
|
123
|
+
|
124
|
+
Rails/IndexWith:
|
125
|
+
Description: Use index_with instead of manually building hashes with same values
|
126
|
+
Enabled: true
|
127
|
+
|
128
|
+
Rails/InverseOf:
|
129
|
+
Description: Specify inverse_of for associations to improve performance
|
130
|
+
Enabled: true
|
131
|
+
|
132
|
+
Rails/LexicallyScopedActionFilter:
|
133
|
+
Description: Avoid lexically scoped action filters
|
134
|
+
Enabled: true
|
135
|
+
|
136
|
+
Rails/LinkToBlank:
|
137
|
+
Description: Add rel="noopener" when using target="_blank" in links
|
138
|
+
Enabled: true
|
139
|
+
|
140
|
+
Rails/MailerName:
|
141
|
+
Description: Mailer class names should end with 'Mailer'
|
142
|
+
Enabled: true
|
143
|
+
|
144
|
+
Rails/MatchRoute:
|
145
|
+
Description: Avoid using match with :via option in routes
|
146
|
+
Enabled: true
|
147
|
+
|
148
|
+
Rails/NegateInclude:
|
149
|
+
Description: Use exclude? instead of !include?
|
150
|
+
Enabled: true
|
151
|
+
|
152
|
+
Rails/NotNullColumn:
|
153
|
+
Description: Add NOT NULL constraint to columns that should not be null
|
154
|
+
Enabled: true
|
155
|
+
|
156
|
+
Rails/OrderById:
|
157
|
+
Description: Specify explicit order when using first/last/take
|
158
|
+
Enabled: true
|
159
|
+
|
160
|
+
Rails/Output:
|
161
|
+
Description: Avoid puts/p in production code
|
162
|
+
Enabled: true
|
163
|
+
Include:
|
164
|
+
- app/**/*.rb
|
165
|
+
- lib/**/*.rb
|
166
|
+
Exclude:
|
167
|
+
- db/seeds.rb
|
168
|
+
- lib/tasks/**/*.rb
|
169
|
+
|
170
|
+
Rails/OutputSafety:
|
171
|
+
Description: Avoid bypassing Rails output safety mechanisms
|
172
|
+
Enabled: true
|
173
|
+
|
174
|
+
Rails/Pick:
|
175
|
+
Description: Use pick instead of pluck().first
|
176
|
+
Enabled: true
|
177
|
+
|
178
|
+
Rails/PluckInWhere:
|
179
|
+
Description: Use exists? instead of pluck in where clauses
|
180
|
+
Enabled: true
|
181
|
+
|
182
|
+
Rails/Presence:
|
183
|
+
Description: Use presence method for conditional assignments
|
184
|
+
Enabled: true
|
185
|
+
|
186
|
+
Rails/Present:
|
187
|
+
Description: Use present? instead of !blank?
|
188
|
+
Enabled: true
|
189
|
+
|
190
|
+
Rails/RedundantAllowNil:
|
191
|
+
Description: Avoid redundant allow_nil option
|
192
|
+
Enabled: true
|
193
|
+
|
194
|
+
Rails/RedundantForeignKey:
|
195
|
+
Description: Avoid redundant foreign_key option
|
196
|
+
Enabled: true
|
197
|
+
|
198
|
+
Rails/RedundantPresenceValidationOnBelongsTo:
|
199
|
+
Description: Avoid redundant presence validation on belongs_to associations
|
200
|
+
Enabled: true
|
201
|
+
|
202
|
+
Rails/RedundantReceiverInWithOptions:
|
203
|
+
Description: Avoid redundant receiver in with_options block
|
204
|
+
Enabled: true
|
205
|
+
|
206
|
+
Rails/ReflectionClassName:
|
207
|
+
Description: Use string class names in associations for better performance
|
208
|
+
Enabled: true
|
209
|
+
|
210
|
+
Rails/RelativeDateConstant:
|
211
|
+
Description: Avoid using relative date constants
|
212
|
+
Enabled: true
|
213
|
+
|
214
|
+
Rails/RenderInline:
|
215
|
+
Description: Avoid inline rendering in controllers
|
216
|
+
Enabled: true
|
217
|
+
|
218
|
+
Rails/RenderPlainText:
|
219
|
+
Description: Use render plain instead of render text
|
220
|
+
Enabled: true
|
221
|
+
|
222
|
+
Rails/RequestReferer:
|
223
|
+
Description: Use request.referer instead of request.referrer
|
224
|
+
Enabled: true
|
225
|
+
|
226
|
+
Rails/ReversibleMigration:
|
227
|
+
Description: Ensure migrations are reversible
|
228
|
+
Enabled: true
|
229
|
+
|
230
|
+
Rails/SafeNavigation:
|
231
|
+
Description: Use safe navigation instead of try!
|
232
|
+
Enabled: true
|
233
|
+
|
234
|
+
Rails/SafeNavigationWithBlank:
|
235
|
+
Description: Avoid safe navigation with blank?
|
236
|
+
Enabled: true
|
237
|
+
|
238
|
+
Rails/ScopeArgs:
|
239
|
+
Description: Use lambda for scope arguments
|
240
|
+
Enabled: true
|
241
|
+
|
242
|
+
Rails/ShortI18n:
|
243
|
+
Description: Use short I18n methods (t instead of translate)
|
244
|
+
Enabled: true
|
245
|
+
|
246
|
+
Rails/SkipsModelValidations:
|
247
|
+
Description: Avoid methods that skip model validations
|
248
|
+
Enabled: true
|
249
|
+
ForbiddenMethods:
|
250
|
+
- decrement!
|
251
|
+
- decrement_counter
|
252
|
+
- increment!
|
253
|
+
- increment_counter
|
254
|
+
- toggle!
|
255
|
+
- touch
|
256
|
+
- touch_all
|
257
|
+
- update_all
|
258
|
+
- update_attribute
|
259
|
+
- update_column
|
260
|
+
- update_columns
|
261
|
+
- update_counters
|
262
|
+
Exclude:
|
263
|
+
- spec/**/*
|
264
|
+
- test/**/*
|
265
|
+
- db/migrate/**/*
|
266
|
+
|
267
|
+
Rails/SquishedSQLHeredocs:
|
268
|
+
Description: Use squiggly heredocs for SQL
|
269
|
+
Enabled: true
|
270
|
+
|
271
|
+
Rails/StripHeredoc:
|
272
|
+
Description: Use strip_heredoc for multi-line strings
|
273
|
+
Enabled: true
|
274
|
+
|
275
|
+
Rails/TimeZone:
|
276
|
+
Description: Use Rails time zone methods
|
277
|
+
Enabled: true
|
278
|
+
|
279
|
+
Rails/TimeZoneAssignment:
|
280
|
+
Description: Use Time.zone= for setting time zone
|
281
|
+
Enabled: true
|
282
|
+
|
283
|
+
Rails/UnknownEnv:
|
284
|
+
Description: Avoid unknown Rails environments
|
285
|
+
Enabled: true
|
286
|
+
Environments:
|
287
|
+
- development
|
288
|
+
- test
|
289
|
+
- production
|
290
|
+
- staging
|
291
|
+
|
292
|
+
Rails/UnusedIgnoredColumns:
|
293
|
+
Description: Remove unused ignored columns
|
294
|
+
Enabled: true
|
295
|
+
|
296
|
+
Rails/Validation:
|
297
|
+
Description: Use validates instead of validate with custom validator
|
298
|
+
Enabled: true
|
299
|
+
|
300
|
+
Rails/WhereEquals:
|
301
|
+
Description: Use where with hash conditions instead of SQL strings
|
302
|
+
Enabled: true
|
303
|
+
|
304
|
+
Rails/WhereExists:
|
305
|
+
Description: Use exists instead of where with present check
|
306
|
+
Enabled: true
|
307
|
+
|
308
|
+
Rails/WhereNot:
|
309
|
+
Description: Use where.not instead of where with negation
|
310
|
+
Enabled: true
|
311
|
+
|
312
|
+
Rails/WhereMissing:
|
313
|
+
Description: Use where.missing instead of left joins with null checks
|
314
|
+
Enabled: true
|
315
|
+
|
316
|
+
# ==========================================
|
317
|
+
# Rails 7.0+ Enhanced Cops (where available)
|
318
|
+
# ==========================================
|
319
|
+
|
320
|
+
Rails/CompactBlank:
|
321
|
+
Description: Use compact_blank instead of reject(&:blank?)
|
322
|
+
Enabled: true
|
323
|
+
|
324
|
+
Rails/DuplicateAssociation:
|
325
|
+
Description: Avoid duplicate associations in models
|
326
|
+
Enabled: true
|
327
|
+
|
328
|
+
Rails/DuplicateScope:
|
329
|
+
Description: Avoid duplicate scopes in models
|
330
|
+
Enabled: true
|
331
|
+
|
332
|
+
Rails/ExpandedDateRange:
|
333
|
+
Description: Use Range#cover? instead of Range#include? for date ranges
|
334
|
+
Enabled: true
|
335
|
+
|
336
|
+
Rails/I18nLazyLookup:
|
337
|
+
Description: Use lazy lookup for I18n keys in controllers and views
|
338
|
+
Enabled: true
|
339
|
+
|
340
|
+
Rails/Inquiry:
|
341
|
+
Description: Use ActiveSupport::StringInquirer for string inquiry methods
|
342
|
+
Enabled: true
|
343
|
+
|
344
|
+
Rails/PluralizationGrammar:
|
345
|
+
Description: Use correct pluralization grammar
|
346
|
+
Enabled: true
|
347
|
+
|
348
|
+
Rails/ResponseParsedBody:
|
349
|
+
Description: Use response.parsed_body in tests
|
350
|
+
Enabled: true
|
351
|
+
|
352
|
+
Rails/RootJoinChain:
|
353
|
+
Description: Use Rails.root.join for multiple path segments
|
354
|
+
Enabled: true
|
355
|
+
|
356
|
+
Rails/ToFormattedS:
|
357
|
+
Description: Use to_formatted_s instead of to_s with format
|
358
|
+
Enabled: true
|
359
|
+
|
360
|
+
Rails/ToSWithArgument:
|
361
|
+
Description: Use to_formatted_s instead of to_s with argument
|
362
|
+
Enabled: true
|
363
|
+
|
364
|
+
Rails/TopLevelHashWithIndifferentAccess:
|
365
|
+
Description: Avoid top-level HashWithIndifferentAccess
|
366
|
+
Enabled: true
|
367
|
+
|
368
|
+
Rails/TransactionExitStatement:
|
369
|
+
Description: Avoid transaction exit statements
|
370
|
+
Enabled: true
|
371
|
+
|
372
|
+
Rails/UniqueValidationWithoutIndex:
|
373
|
+
Description: Add database index for unique validations
|
374
|
+
Enabled: true
|
@@ -0,0 +1,29 @@
|
|
1
|
+
RSpec/AnyInstance:
|
2
|
+
Description: Check that instances are not being stubbed globally.
|
3
|
+
Prefer instance doubles over stubbing any instance of a class
|
4
|
+
Enabled: false
|
5
|
+
|
6
|
+
RSpec/ContextWording:
|
7
|
+
Description: Checks that context docstring starts with an allowed prefix.
|
8
|
+
Enabled: true
|
9
|
+
Prefixes:
|
10
|
+
- when
|
11
|
+
- with
|
12
|
+
- without
|
13
|
+
- and # custom
|
14
|
+
|
15
|
+
RSpec/ExampleLength:
|
16
|
+
Description: Checks for long examples.
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
RSpec/MultipleExpectations:
|
20
|
+
Description: Checks if examples contain too many expect calls.
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
RSpec/MultipleMemoizedHelpers:
|
24
|
+
Description: Checks if example groups contain too many let and subject calls.
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
RSpec/NestedGroups:
|
28
|
+
Description: Checks for nested example groups.
|
29
|
+
Enabled: false
|
@@ -0,0 +1,197 @@
|
|
1
|
+
Style/AndOr:
|
2
|
+
Description: Use &&/|| instead of and/or.
|
3
|
+
Enabled: true
|
4
|
+
EnforcedStyle: always
|
5
|
+
SupportedStyles:
|
6
|
+
- always
|
7
|
+
- conditionals
|
8
|
+
|
9
|
+
Style/ClassAndModuleChildren:
|
10
|
+
Description: Checks the style of children definitions at classes and modules.
|
11
|
+
Enabled: true
|
12
|
+
EnforcedStyle: nested
|
13
|
+
|
14
|
+
Style/ColonMethodCall:
|
15
|
+
Description: Checks for methods invoked via the operator instead of the . operator
|
16
|
+
Enabled: true
|
17
|
+
|
18
|
+
Style/DefWithParentheses:
|
19
|
+
Description: Checks for parentheses in the definition of a method, that does not take any
|
20
|
+
arguments.
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
Style/DisableCopsWithinSourceCodeDirective:
|
24
|
+
Description: Detects comments to enable/disable RuboCop. This is useful if want to make sure that every RuboCop error gets fixed and not quickly disabled with a comment.
|
25
|
+
Enabled: true
|
26
|
+
AllowedCops:
|
27
|
+
- Layout/ArgumentAlignment
|
28
|
+
- Layout/ArrayAlignment
|
29
|
+
- Layout/HashAlignment
|
30
|
+
- Layout/IndentationConsistency
|
31
|
+
- Layout/IndentationWidth
|
32
|
+
- Layout/LineLength
|
33
|
+
- Layout/MultilineArrayBraceLayout
|
34
|
+
- Lint/DuplicateMethods
|
35
|
+
- Lint/RescueException
|
36
|
+
- Lint/UnusedMethodArgument
|
37
|
+
- Lint/UselessAssignment
|
38
|
+
- Lint/Void
|
39
|
+
- Metrics/BlockNesting
|
40
|
+
- Metrics/ClassLength
|
41
|
+
- Metrics/CyclomaticComplexity
|
42
|
+
- Metrics/ModuleLength
|
43
|
+
- Metrics/ParameterLists
|
44
|
+
- Metrics/PerceivedComplexity
|
45
|
+
- Naming/AccessorMethodName
|
46
|
+
- Naming/PredicateName
|
47
|
+
- Naming/VariableNumber
|
48
|
+
- Rails/ApplicationController
|
49
|
+
- Rails/FilePath
|
50
|
+
- Rails/HasManyOrHasOneDependent
|
51
|
+
- Rails/InverseOf
|
52
|
+
- Rails/OutputSafety
|
53
|
+
- Rails/UniqueValidationWithoutIndex
|
54
|
+
- RSpec/BeforeAfterAll
|
55
|
+
- RSpec/DescribeClass
|
56
|
+
- RSpec/DescribedClass
|
57
|
+
- RSpec/EmptyLineAfterFinalLet
|
58
|
+
- RSpec/ExampleLength
|
59
|
+
- RSpec/FilePath
|
60
|
+
- RSpec/ImplicitExpect
|
61
|
+
- RSpec/ImplicitSubject
|
62
|
+
- RSpec/InstanceVariable
|
63
|
+
- RSpec/LeadingSubject
|
64
|
+
- RSpec/LetSetup
|
65
|
+
- RSpec/MessageChain
|
66
|
+
- RSpec/MessageSpies
|
67
|
+
- RSpec/MultipleExpectations
|
68
|
+
- RSpec/NamedSubject
|
69
|
+
- RSpec/PredicateMatcher
|
70
|
+
- RSpec/StubbedMock
|
71
|
+
- RSpec/SubjectStub
|
72
|
+
- RSpec/VerifiedDoubles
|
73
|
+
- Security/Open
|
74
|
+
- Style/AccessModifierDeclarations
|
75
|
+
- Style/CaseLikeIf
|
76
|
+
- Style/Documentation
|
77
|
+
- Style/DoubleNegation
|
78
|
+
- Style/GlobalVars
|
79
|
+
- Style/GuardClause
|
80
|
+
- Style/IfUnlessModifier
|
81
|
+
- Style/OptionalBooleanParameter
|
82
|
+
- Style/RedundantBegin
|
83
|
+
- Style/RescueModifier
|
84
|
+
- Style/SignalException
|
85
|
+
- Style/StringConcatenation
|
86
|
+
- Style/SymbolArray
|
87
|
+
- Style/WordArray
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
Style/FrozenStringLiteralComment:
|
92
|
+
Description: Add the frozen_string_literal comment to the top of files to help transition
|
93
|
+
from Ruby 2.3.0 to Ruby 3.0. Enabled for Ruby 3.1+ performance benefits.
|
94
|
+
Enabled: true
|
95
|
+
EnforcedStyle: always_true
|
96
|
+
SupportedStyles:
|
97
|
+
- always
|
98
|
+
- always_true
|
99
|
+
- never
|
100
|
+
# Only require in Ruby 3.0+ projects for performance benefits
|
101
|
+
Include:
|
102
|
+
- "**/*.rb"
|
103
|
+
Exclude:
|
104
|
+
- "bin/**/*"
|
105
|
+
- "config/boot.rb"
|
106
|
+
- "db/migrate/**/*"
|
107
|
+
|
108
|
+
Style/HashSyntax:
|
109
|
+
Description: Checks hash literal syntax
|
110
|
+
Enabled: true
|
111
|
+
EnforcedStyle: ruby19
|
112
|
+
UseHashRocketsWithSymbolValues: false
|
113
|
+
PreferHashRocketsForNonAlnumEndingSymbols: false
|
114
|
+
SupportedStyles:
|
115
|
+
- ruby19
|
116
|
+
- hash_rockets
|
117
|
+
- no_mixed_keys
|
118
|
+
- ruby19_no_mixed_keys
|
119
|
+
|
120
|
+
Style/MethodDefParentheses:
|
121
|
+
Description: Checks if the method definitions have or don't have parentheses.
|
122
|
+
Enabled: true
|
123
|
+
EnforcedStyle: require_parentheses
|
124
|
+
SupportedStyles:
|
125
|
+
- require_parentheses
|
126
|
+
- require_no_parentheses
|
127
|
+
- require_no_parentheses_except_multiline
|
128
|
+
|
129
|
+
Style/NumericLiterals:
|
130
|
+
Description: Checks for big numeric literals without _ between groups of digits in them
|
131
|
+
Enabled: false
|
132
|
+
|
133
|
+
Style/ParenthesesAroundCondition:
|
134
|
+
Description: Checks for the presence of superfluous parentheses around the condition of
|
135
|
+
if/unless/while/until.
|
136
|
+
Enabled: true
|
137
|
+
AllowSafeAssignment: true
|
138
|
+
AllowInMultilineConditions: false
|
139
|
+
|
140
|
+
Style/RedundantBegin:
|
141
|
+
Description: Checks for redundant begin blocks.
|
142
|
+
Enabled: true
|
143
|
+
|
144
|
+
Style/RedundantFreeze:
|
145
|
+
Description: Checks usages of Object#freeze on immutable objects.
|
146
|
+
Enabled: true
|
147
|
+
|
148
|
+
Style/RedundantPercentQ:
|
149
|
+
Description: Checks for %q/%Q when single quotes or double quotes would do.
|
150
|
+
Enabled: true
|
151
|
+
|
152
|
+
Style/RedundantReturn:
|
153
|
+
Description: Checks for redundant return expressions.
|
154
|
+
Enabled: true
|
155
|
+
AllowMultipleReturnValues: true
|
156
|
+
|
157
|
+
Style/RegexpLiteral:
|
158
|
+
Description: Use / or %r around regular expressions.
|
159
|
+
Enabled: true
|
160
|
+
EnforcedStyle: slashes
|
161
|
+
AllowInnerSlashes: false
|
162
|
+
SupportedStyles:
|
163
|
+
- slashes
|
164
|
+
- percent_r
|
165
|
+
- mixed
|
166
|
+
|
167
|
+
Style/Semicolon:
|
168
|
+
Description: Checks for multiple expressions placed on the same line. It also checks for lines
|
169
|
+
terminated with a semicolon.
|
170
|
+
Enabled: true
|
171
|
+
AllowAsExpressionSeparator: true
|
172
|
+
|
173
|
+
Style/StringLiterals:
|
174
|
+
Description: Checks if uses of quotes match the configured preference.
|
175
|
+
Enabled: true
|
176
|
+
EnforcedStyle: double_quotes
|
177
|
+
ConsistentQuotesInMultiline: true
|
178
|
+
|
179
|
+
Style/TrailingCommaInArrayLiteral:
|
180
|
+
Description: Checks for trailing comma in array literals
|
181
|
+
Enabled: true
|
182
|
+
EnforcedStyleForMultiline: consistent_comma
|
183
|
+
|
184
|
+
Style/TrailingCommaInHashLiteral:
|
185
|
+
Description: Checks for trailing comma in hash literals
|
186
|
+
Enabled: true
|
187
|
+
EnforcedStyleForMultiline: consistent_comma
|
188
|
+
|
189
|
+
Style/TrivialAccessors:
|
190
|
+
Description: Checks for trivial reader/writer methods, that c`ould have been created with the
|
191
|
+
attr_* family of functions automatically.
|
192
|
+
Enabled: true
|
193
|
+
ExactNameMatch: true
|
194
|
+
AllowPredicates: true
|
195
|
+
AllowDSLWriters: true
|
196
|
+
IgnoreClassMethods: false
|
197
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
|
5
|
+
require "rubocop/hk"
|
6
|
+
|
7
|
+
module Rubocop
|
8
|
+
module Hk
|
9
|
+
##
|
10
|
+
# CLI entry point for commands
|
11
|
+
#
|
12
|
+
class Command < Thor
|
13
|
+
def self.exit_on_failure?
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "version", "Get the version of rubocop-hk"
|
18
|
+
option :plain, type: :boolean, default: false, aliases: ["-p"]
|
19
|
+
def version
|
20
|
+
return puts Rubocop::Hk::VERSION if options[:plain]
|
21
|
+
|
22
|
+
puts "rubocop-hk version: #{Rubocop::Hk::VERSION}"
|
23
|
+
end
|
24
|
+
map ["-v", "--version"] => :version
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|