rubocop-gusto 10.1.1 → 10.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a06f9920ea80223223c9353783cfc0a8824f232cc3e18c323195811a28eb28a
4
- data.tar.gz: 2943d0fd74fc5f31be0f0527e136ee034514d4215357c33e5c64207e377855e1
3
+ metadata.gz: ad5b8322bb818e1f765532f2757ae7bcce5bf7275ef22ced8700f87883715972
4
+ data.tar.gz: aff19b02288f2b23afb2df259a2a63b441189527d9d91f2e115ab75c7a2f1746
5
5
  SHA512:
6
- metadata.gz: 7dffff3eae0680c7ced3dfd4fc42eb98b37431a86aebcce90c0492a3c05f9c7f13a38c3634037aa3da96647d9857e8553af6ca155ba3707bbcf0a7e9d3fa2e42
7
- data.tar.gz: ebc7a8072aa0e99bf33f1596aa4502573c99006d28ba179f15fa5c32394d6dc27f94bebc322942c586157e6549a7b2c25b907fd3f4092f4f9f604c58bbd1579a
6
+ metadata.gz: ed0bc51d62ead56c64464e36bd9142d6600d2a05430fc78c0510b50d577ccdb10d376de287079bec788abca083e40804eb59e6056f45743b9f8ac80576df7067
7
+ data.tar.gz: 39af6427e9a5b54b167c26679c314272c26c178b645bcb141b373da48c6829ee1d61d515518398bdf64b9279e8f005ba618674cda144fd80d873988198c2066e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  ## Pending
2
2
 
3
+ ## 10.2.0
4
+
5
+ - Fix Sorbet sigil exclusions, exclude specs from strict, and add rubocop-sorbet dependency
6
+ - Add ActiveSupportExtensionsEnabled to rails config
7
+ - Fix infinite loop and splitting problem in init command
8
+ - Use default Style/InverseMethods configuration
9
+
10
+ ## 10.1.1
11
+
12
+ - Opt in to Rails/IgnoredColumnsAssignment
13
+ - Revert "Add Gusto/IgnoredColumnAssignment"
14
+ - Update rubocop dependency from 1.79.0 to 1.79.1
15
+
16
+ ## 10.1.0
17
+
18
+ - Add Gusto/IgnoredColumnAssignment cop
19
+
3
20
  ## 10.0.1
4
21
 
5
22
  - Require rubocop >= 1.76 to ensure Naming/PredicatePrefix is available.
data/config/default.yml CHANGED
@@ -2,6 +2,7 @@ plugins:
2
2
  - rubocop-rspec
3
3
  - rubocop-performance
4
4
  - rubocop-rake
5
+ - rubocop-sorbet
5
6
 
6
7
  # After you add a rule, sort this file with `bundle exec rubocop-gusto sort config/default.yml`
7
8
 
@@ -341,9 +342,6 @@ RSpec/DescribedClass:
341
342
 
342
343
  RSpec/DescribedClassModuleWrapping:
343
344
  Enabled: true
344
- # TODO: improve this file matching pattern
345
- Include:
346
- - '**/spec/**/*_spec.rb'
347
345
 
348
346
  RSpec/ExampleLength:
349
347
  Enabled: false
@@ -426,7 +424,6 @@ Rake/ClassDefinitionInTask:
426
424
  Enabled: false
427
425
 
428
426
  Rake/Desc:
429
- # TODO: Roll this out.
430
427
  Enabled: true
431
428
 
432
429
  Security/YAMLLoad:
@@ -443,11 +440,7 @@ Sorbet:
443
440
  Sorbet/FalseSigil:
444
441
  # We want to avoid `typed: ignore` as much as possible, as it breaks LSP tooling.
445
442
  Include:
446
- - "**/*.{rb,rbi,rake,ru}"
447
- Exclude:
448
- - bin/**/*
449
- - db/**/*.rb
450
- - script/**/*
443
+ - "**/*.{rb,rbi,rake,ru}"
451
444
 
452
445
  Sorbet/Refinement:
453
446
  # Still marked pending upstream, we contributed this and enable it here.
@@ -457,6 +450,13 @@ Sorbet/StrictSigil:
457
450
  # Forgot the difference between typed levels? (ignore, false, true, strict, and strong)
458
451
  # Check this out: https://sorbet.org/docs/static#file-level-granularity-strictness-levels
459
452
  Enabled: true
453
+ Include:
454
+ - "**/*.{rb,rbi,rake,ru}"
455
+ Exclude:
456
+ - bin/**/*
457
+ - db/**/*.rb
458
+ - script/**/*
459
+ - spec/**/*spec.rb
460
460
 
461
461
  Sorbet/ValidSigil:
462
462
  Enabled: true
@@ -479,7 +479,6 @@ Style/Alias:
479
479
  EnforcedStyle: prefer_alias_method
480
480
 
481
481
  Style/AsciiComments:
482
- # TODO: roll this out fully
483
482
  Enabled: true
484
483
 
485
484
  Style/AutoResourceCleanup:
@@ -542,9 +541,9 @@ Style/FrozenStringLiteralComment:
542
541
  EnforcedStyle: always
543
542
  Enabled: true
544
543
 
544
+ # This can make lines longer and impair readability
545
545
  Style/GuardClause:
546
546
  Enabled: false
547
- MinBodyLength: 4
548
547
 
549
548
  Style/HashEachMethods:
550
549
  Enabled: true
@@ -559,7 +558,7 @@ Style/HashTransformValues:
559
558
  Enabled: false
560
559
 
561
560
  Style/IfInsideElse:
562
- Enabled: false
561
+ Enabled: false
563
562
 
564
563
  Style/IfUnlessModifier:
565
564
  Enabled: false
@@ -567,9 +566,6 @@ Style/IfUnlessModifier:
567
566
  Style/ImplicitRuntimeError:
568
567
  Enabled: false
569
568
 
570
- Style/InverseMethods:
571
- Enabled: false
572
-
573
569
  Style/Lambda:
574
570
  EnforcedStyle: literal
575
571
 
@@ -752,7 +748,6 @@ Style/SymbolProc:
752
748
  Enabled: true
753
749
 
754
750
  Style/TernaryParentheses:
755
- Enabled: false
756
751
  EnforcedStyle: require_parentheses_when_complex
757
752
 
758
753
  Style/TrailingCommaInArguments:
data/config/rails.yml CHANGED
@@ -7,6 +7,7 @@ plugins:
7
7
  - rubocop-rails
8
8
 
9
9
  AllCops:
10
+ ActiveSupportExtensionsEnabled: true
10
11
  TargetRubyVersion: <%= RbConfig::CONFIG['RUBY_API_VERSION'] %>
11
12
  MaxFilesInCache: 100000
12
13
  Exclude:
@@ -16,6 +17,9 @@ AllCops:
16
17
  - 'db/**/*schema.rb'
17
18
  - 'db/seeds{.rb,/**/*}'
18
19
 
20
+ Performance/DoubleStartEndWith:
21
+ IncludeActiveSupportAliases: true
22
+
19
23
  Rails:
20
24
  Enabled: true
21
25
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pathname"
4
+ require "yaml"
4
5
 
5
6
  module RuboCop
6
7
  module Gusto
@@ -110,21 +111,46 @@ module RuboCop
110
111
  # Try to find a line that exactly matches KEY_REGEX
111
112
  # Use rstrip, not strip, to preserve indentation
112
113
  name_line = chunk.find { |line| line.rstrip.match?(KEY_REGEX) }
113
- name_line&.rstrip&.delete_suffix(":")
114
+ if name_line
115
+ name_line.rstrip.delete_suffix(":")
116
+ else
117
+ # Try to find a key with value on the same line (e.g., "inherit_from: .rubocop_todo.yml")
118
+ first_line = chunk.find { |line| !line.strip.empty? && !line.strip.start_with?("#") }
119
+ if first_line&.include?(":")
120
+ first_line.split(":").first.strip
121
+ end
122
+ end
114
123
  end
115
124
 
116
125
  # Splits the lines into blocks whenever we drop from indented to unindented
117
126
  def chunk_blocks(lines)
118
- # slice whenever we drop from indented to unindented
127
+ # slice whenever we drop from indented to unindented line
128
+ # or when we encounter a new top-level key after blank line(s)
119
129
  chunks = lines.slice_when do |prev, line|
120
- prev.match?(INDENT_REGEX) && !prev.strip.empty? && !line.match?(INDENT_REGEX)
130
+ if prev.strip.empty?
131
+ # split when going from blank to non-indented non-blank
132
+ !line.match?(INDENT_REGEX) && !line.strip.empty?
133
+ elsif prev.match?(INDENT_REGEX)
134
+ # split when going from indented to non-blank unindented
135
+ !line.match?(INDENT_REGEX) && !line.strip.empty?
136
+ else
137
+ # prev is non-indented, split on blank lines too
138
+ line.strip.empty?
139
+ end
121
140
  end
122
141
 
123
142
  # Process each chunk to remove leading newlines and add 1 trailing newline
124
143
  chunks.filter_map do |chunk|
125
144
  # Remove leading and trailing empty lines
126
- chunk.shift while chunk.first.to_s.strip.empty?
127
- chunk.pop while chunk.last.to_s.strip.empty?
145
+ until chunk.empty? || !chunk.first.strip.empty?
146
+ chunk.shift
147
+ end
148
+ until chunk.empty? || !chunk.last.strip.empty?
149
+ chunk.pop
150
+ end
151
+
152
+ # Skip empty chunks
153
+ next if chunk.empty?
128
154
 
129
155
  # Ensure each chunk ends with a blank newline
130
156
  chunk << "\n"
@@ -1,5 +1,3 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
1
  inherit_mode:
4
2
  merge:
5
3
  - Include
@@ -8,6 +6,8 @@ inherit_gem:
8
6
  rubocop-gusto:
9
7
  - config/default.yml
10
8
 
9
+ inherit_from: .rubocop_todo.yml
10
+
11
11
  plugins:
12
12
  - rubocop-gusto
13
13
  - rubocop-rspec
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Gusto
5
- VERSION = "10.1.1"
5
+ VERSION = "10.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-gusto
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.1.1
4
+ version: 10.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineering
@@ -10,7 +10,7 @@ cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
- name: bigdecimal
13
+ name: lint_roller
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - ">="
@@ -24,35 +24,35 @@ dependencies:
24
24
  - !ruby/object:Gem::Version
25
25
  version: '0'
26
26
  - !ruby/object:Gem::Dependency
27
- name: lint_roller
27
+ name: rubocop
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: '1.76'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: '1.76'
40
40
  - !ruby/object:Gem::Dependency
41
- name: rubocop
41
+ name: rubocop-performance
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: '1.76'
46
+ version: '0'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '1.76'
53
+ version: '0'
54
54
  - !ruby/object:Gem::Dependency
55
- name: rubocop-performance
55
+ name: rubocop-rake
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - ">="
@@ -66,7 +66,7 @@ dependencies:
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  - !ruby/object:Gem::Dependency
69
- name: rubocop-rake
69
+ name: rubocop-rspec
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="
@@ -80,7 +80,7 @@ dependencies:
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  - !ruby/object:Gem::Dependency
83
- name: rubocop-rspec
83
+ name: rubocop-sorbet
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - ">="