Skip to content

Commit 6871fb5

Browse files
authored
Merge pull request #459 from platanus/update-rubocop
Update rubocop
2 parents ea2d2ae + 28c871e commit 6871fb5

38 files changed

+257
-124
lines changed

.rubocop.yml

Lines changed: 122 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
require:
2+
- rubocop-rspec
3+
- rubocop-rails
4+
- rubocop-performance
15
AllCops:
26
Exclude:
37
- "vendor/**/*"
48
- "spec/dummy/db/schema.rb"
59
- "db/schema.rb"
610
- "bin/**/*"
711
- "spec/dummy/db/schema.rb"
8-
DisplayCopNames: false
912
TargetRubyVersion: 2.7
1013
Rails:
1114
Enabled: true
12-
Layout/AlignParameters:
15+
Performance:
16+
Enabled: true
17+
Layout/ParameterAlignment:
1318
Description: Align the parameters of a method call if they span more than one line.
1419
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-double-indent
1520
Enabled: true
@@ -121,7 +126,7 @@ Naming/PredicateName:
121126
- is_
122127
- has_
123128
- have_
124-
NamePrefixBlacklist:
129+
ForbiddenPrefixes:
125130
- is_
126131
Style/RaiseArgs:
127132
Description: Checks the arguments passed to raise/fail.
@@ -172,7 +177,7 @@ Style/TrivialAccessors:
172177
ExactNameMatch: false
173178
AllowPredicates: false
174179
AllowDSLWriters: false
175-
Whitelist:
180+
AllowedMethods:
176181
- to_ary
177182
- to_a
178183
- to_c
@@ -200,6 +205,17 @@ Style/WordArray:
200205
Enabled: false
201206
MinSize: 0
202207
WordRegex: !ruby/regexp /\A[\p{Word}]+\z/
208+
Style/ExponentialNotation:
209+
Enabled: true
210+
Style/HashEachMethods:
211+
Description: Use Hash#each_key and Hash#each_value.
212+
Enabled: true
213+
Style/HashTransformKeys:
214+
Description: Prefer `transform_keys` over `each_with_object` and `map`.
215+
Enabled: true
216+
Style/HashTransformValues:
217+
Description: Prefer `transform_values` over `each_with_object` and `map`.
218+
Enabled: true
203219
Metrics/AbcSize:
204220
Description: A calculated magnitude based on number of assignments, branches, and
205221
conditions.
@@ -215,15 +231,6 @@ Metrics/ClassLength:
215231
Enabled: false
216232
CountComments: false
217233
Max: 100
218-
Metrics/LineLength:
219-
Description: Limit lines to 100 characters.
220-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#100-character-limits
221-
Enabled: true
222-
Max: 100
223-
AllowURI: true
224-
URISchemes:
225-
- http
226-
- https
227234
Metrics/MethodLength:
228235
Description: Avoid methods longer than 15 lines of code.
229236
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
@@ -243,6 +250,15 @@ Lint/AssignmentInCondition:
243250
StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
244251
Enabled: false
245252
AllowSafeAssignment: true
253+
Layout/LineLength:
254+
Description: Limit lines to 100 characters.
255+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#100-character-limits
256+
Enabled: true
257+
Max: 100
258+
AllowURI: true
259+
URISchemes:
260+
- http
261+
- https
246262
Layout/EndAlignment:
247263
Description: Align ends correctly.
248264
Enabled: true
@@ -257,13 +273,69 @@ Layout/DefEndAlignment:
257273
SupportedStylesAlignWith:
258274
- start_of_line
259275
- def
276+
Layout/SpaceAroundMethodCallOperator:
277+
Description: Checks method call operators to not have spaces around them.
278+
Enabled: true
260279
Style/SymbolArray:
261280
Description: Use %i or %I for arrays of symbols.
262281
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-i
263282
Enabled: false
264283
Layout/ExtraSpacing:
265284
Description: Do not use unnecessary spacing.
266285
Enabled: false
286+
Layout/ClassStructure:
287+
Enabled: true
288+
Categories:
289+
validation:
290+
- validate
291+
- validates
292+
association:
293+
- belongs_to
294+
- has_one
295+
- has_many
296+
- has_and_belongs_to_many
297+
attribute_macros:
298+
- attribute
299+
- attr_accessor
300+
- attr_reader
301+
- attr_writer
302+
callbacks:
303+
- before_validation
304+
- after_validation
305+
- before_save
306+
- before_create
307+
- after_create
308+
- after_save
309+
- after_commit
310+
- after_create_commit
311+
other_macros:
312+
- devise
313+
- acts_as_token_authenticatable
314+
- accepts_nested_attributes_for
315+
- humanize
316+
- monetize
317+
scope:
318+
- scope
319+
- pg_search_scope
320+
ExpectedOrder:
321+
- module_inclusion
322+
- constants
323+
- public_attribute_macros
324+
- association
325+
- validation
326+
- enum
327+
- aasm
328+
- scope
329+
- public_delegate
330+
- other_macros
331+
- class_methods
332+
- initializer
333+
- public_methods
334+
- protected_attribute_macros
335+
- protected_methods
336+
- private_attribute_macros
337+
- private_delegate
338+
- private_methods
267339
Naming/AccessorMethodName:
268340
Description: Check the naming of accessor methods for get_/set_.
269341
Enabled: false
@@ -444,7 +516,7 @@ Lint/DeprecatedClassMethods:
444516
Lint/ElseLayout:
445517
Description: Check for odd code arrangement in an else block.
446518
Enabled: false
447-
Lint/HandleExceptions:
519+
Lint/SuppressedException:
448520
Description: Don't suppress exception.
449521
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
450522
Enabled: false
@@ -472,10 +544,43 @@ Lint/UnderscorePrefixedVariableName:
472544
Lint/Void:
473545
Description: Possible use of operator/literal/variable in void context.
474546
Enabled: false
475-
Rails/Delegate:
476-
Description: Prefer delegate method for delegations.
477-
Enabled: false
547+
Lint/RaiseException:
548+
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
549+
Enabled: true
550+
Lint/StructNewOverride:
551+
Description: Disallow overriding the `Struct` built-in methods via `Struct.new`.
552+
Enabled: true
478553
Performance/RedundantBlockCall:
479554
Description: Use `yield` instead of `block.call`.
480555
Reference: https://github.com/JuanitoFatas/fast-ruby#proccall-vs-yield-code
481556
Enabled: false
557+
Style/OptionalBooleanParameter:
558+
Description: 'Use keyword arguments when defining method with boolean argument.'
559+
Enabled: false
560+
Lint/MissingSuper:
561+
Description: >-
562+
This cop checks for the presence of constructors and lifecycle callbacks
563+
without calls to `super`'.
564+
Enabled: false
565+
Style/RedundantFileExtensionInRequire:
566+
Description: >-
567+
Checks for the presence of superfluous `.rb` extension in
568+
the filename provided to `require` and `require_relative`.
569+
Enabled: false
570+
Gemspec/RequiredRubyVersion:
571+
Enabled: false
572+
RSpec/MultipleExpectations:
573+
Max: 5
574+
RSpec/NestedGroups:
575+
Max: 5
576+
RSpec/ExampleLength:
577+
Max: 10
578+
RSpec/LetSetup:
579+
Enabled: false
580+
RSpec/ExpectChange:
581+
Enabled: true
582+
EnforcedStyle: block
583+
RSpec/FilePath:
584+
Enabled: false
585+
RSpec/InstanceVariable:
586+
Enabled: false

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ gemspec
1515
gem "activeadmin"
1616
gem "mimemagic", github: "mimemagicrb/mimemagic", ref: "01f92d86d15d85cfd0f20dabd025dcbd36a8a60f"
1717

18-
gem "webpacker", "~> 5.0"
18+
gem "webpacker", "~> 5.4"

0 commit comments

Comments
 (0)