carwow_rubocop 6.8.0 → 6.11.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: 9ba532ee22497e6dad682fcd4d4c8f452faf929df1ce5284e3fb5b2a1d3e5ab8
4
- data.tar.gz: b54f7cc75cf53f47012ffde9f5253c06c33cc959fe6f38c7aed526aff30f990c
3
+ metadata.gz: 978ba9d52dc3a0f7c586dab02666847b3e7ac2bcc62990909b4ecab964e794d8
4
+ data.tar.gz: 35c9f5b58b396765fef73fa76e622ce28029843a96fc25f6f434897a9333cdcd
5
5
  SHA512:
6
- metadata.gz: 7f6d34e7a2768754b1b6171aa09dba55b2a3eff404bc93d6039794630f9440c04304615de5ade41d82e58dcefa8f6ff98396053b68a3dee5da6e104746f49084
7
- data.tar.gz: 47a4d2cfd627a6fda855df105eb4e6ccc8b246e602badaf823f253c9ddf3952aa6deca294c90c85e9dd1dc3eb1284846291880663dbce6bead17ffb187fa518d
6
+ metadata.gz: 51ca0f3638fd002ef701414af166ff97f63ab65f28031e385130e3813721b534ef88e75ecb3b36988d303c040a0df710552d2e210b4b242387df97a10dae2f43
7
+ data.tar.gz: d4a8e1e9941469ac1a1a3f88a803ddcf38c2f8992f1aefd14a0ffdb97ceda74af045de2717c49e196c072fbedc162779014457ac14ecd0eb8374c04f575d924e
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- carwow_rubocop (6.8.0)
4
+ carwow_rubocop (6.11.0)
5
5
  rubocop (>= 1.75)
6
6
  rubocop-factory_bot
7
7
  rubocop-performance
8
- rubocop-rspec (>= 3.2, < 3.6)
8
+ rubocop-rspec (~> 3.2)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
@@ -13,22 +13,22 @@ GEM
13
13
  ast (2.4.3)
14
14
  coderay (1.1.3)
15
15
  diff-lcs (1.5.1)
16
- json (2.10.2)
17
- language_server-protocol (3.17.0.4)
16
+ json (2.21.2)
17
+ language_server-protocol (3.17.0.6)
18
18
  lint_roller (1.1.0)
19
19
  method_source (1.1.0)
20
- parallel (1.26.3)
21
- parser (3.3.7.4)
20
+ parallel (2.1.0)
21
+ parser (3.3.12.0)
22
22
  ast (~> 2.4.1)
23
23
  racc
24
- prism (1.4.0)
24
+ prism (1.9.0)
25
25
  pry (0.15.2)
26
26
  coderay (~> 1.1)
27
27
  method_source (~> 1.0)
28
28
  racc (1.8.1)
29
29
  rainbow (3.1.1)
30
30
  rake (13.2.1)
31
- regexp_parser (2.10.0)
31
+ regexp_parser (2.12.0)
32
32
  rspec (3.13.0)
33
33
  rspec-core (~> 3.13.0)
34
34
  rspec-expectations (~> 3.13.0)
@@ -42,20 +42,20 @@ GEM
42
42
  diff-lcs (>= 1.2.0, < 2.0)
43
43
  rspec-support (~> 3.13.0)
44
44
  rspec-support (3.13.1)
45
- rubocop (1.75.2)
45
+ rubocop (1.89.0)
46
46
  json (~> 2.3)
47
47
  language_server-protocol (~> 3.17.0.2)
48
48
  lint_roller (~> 1.1.0)
49
- parallel (~> 1.10)
49
+ parallel (>= 1.10)
50
50
  parser (>= 3.3.0.2)
51
51
  rainbow (>= 2.2.2, < 4.0)
52
52
  regexp_parser (>= 2.9.3, < 3.0)
53
- rubocop-ast (>= 1.44.0, < 2.0)
53
+ rubocop-ast (>= 1.49.0, < 2.0)
54
54
  ruby-progressbar (~> 1.7)
55
55
  unicode-display_width (>= 2.4.0, < 4.0)
56
- rubocop-ast (1.44.0)
56
+ rubocop-ast (1.50.0)
57
57
  parser (>= 3.3.7.2)
58
- prism (~> 1.4)
58
+ prism (~> 1.7)
59
59
  rubocop-factory_bot (2.27.1)
60
60
  lint_roller (~> 1.1)
61
61
  rubocop (~> 1.72, >= 1.72.1)
@@ -63,13 +63,14 @@ GEM
63
63
  lint_roller (~> 1.1)
64
64
  rubocop (>= 1.72.1, < 2.0)
65
65
  rubocop-ast (>= 1.38.0, < 2.0)
66
- rubocop-rspec (3.5.0)
66
+ rubocop-rspec (3.10.2)
67
67
  lint_roller (~> 1.1)
68
- rubocop (~> 1.72, >= 1.72.1)
68
+ regexp_parser (>= 2.0)
69
+ rubocop (~> 1.86, >= 1.86.2)
69
70
  ruby-progressbar (1.13.0)
70
- unicode-display_width (3.1.4)
71
- unicode-emoji (~> 4.0, >= 4.0.4)
72
- unicode-emoji (4.0.4)
71
+ unicode-display_width (3.2.0)
72
+ unicode-emoji (~> 4.1)
73
+ unicode-emoji (4.2.0)
73
74
 
74
75
  PLATFORMS
75
76
  ruby
@@ -14,12 +14,12 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = 'https://github.com/carwow/carwow_rubocop'
15
15
  spec.license = 'MIT'
16
16
 
17
- if spec.respond_to?(:metadata)
18
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
- else
20
- raise 'RubyGems 2.0 or newer is required to protect against ' \
21
- 'public gem pushes.'
22
- end
17
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
18
+
19
+ spec.metadata = {
20
+ 'allowed_push_host' => 'https://rubygems.org',
21
+ 'rubygems_mfa_required' => 'true'
22
+ }
23
23
 
24
24
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
25
  f.match(%r{^(test|spec|features)/})
@@ -35,9 +35,6 @@ Gem::Specification.new do |spec|
35
35
 
36
36
  spec.add_dependency 'rubocop', '>= 1.75'
37
37
  spec.add_dependency 'rubocop-performance'
38
- spec.add_dependency 'rubocop-rspec', '>= 3.2', '< 3.6'
38
+ spec.add_dependency 'rubocop-rspec', '~> 3.2'
39
39
  spec.add_dependency 'rubocop-factory_bot'
40
- spec.metadata = {
41
- 'rubygems_mfa_required' => 'true'
42
- }
43
40
  end
@@ -32,6 +32,10 @@ Carwow/NoStubbingBusinessEvent:
32
32
  - "**/*_spec.rb"
33
33
  - "**/spec/**/*"
34
34
 
35
+ Carwow/NoStubbingHoneycombExtraData:
36
+ Enabled: true
37
+ Include: *spec_only
38
+
35
39
  Carwow/AddColumnWithComment:
36
40
  Enabled: true
37
41
  Include: &migrations_only
@@ -1,5 +1,5 @@
1
1
  module RuboCop
2
2
  module Carwow
3
- VERSION = '6.8.0'.freeze
3
+ VERSION = '6.11.0'.freeze
4
4
  end
5
5
  end
@@ -24,6 +24,11 @@ module RuboCop
24
24
  # queue_as :with_symbol
25
25
  # end
26
26
  #
27
+ # # bad - literals returned from a block are checked too
28
+ # class Bad < ApplicationJob
29
+ # queue_as { urgent? ? :with_symbol : "with_string" }
30
+ # end
31
+ #
27
32
  #
28
33
  class JobsQueueNameStyle < ::RuboCop::Cop::Base
29
34
  extend AutoCorrector
@@ -42,27 +47,49 @@ module RuboCop
42
47
  # optimization: don't call `on_send` unless the method name is in this list
43
48
  RESTRICT_ON_SEND = %i[queue_as].freeze
44
49
  def on_send(node)
45
- _, _queue_as, queue_name = *node
50
+ queue_names(node).each do |queue_name|
51
+ next if preferred_style?(queue_name)
46
52
 
47
- return if prefer_symbol? && queue_name.sym_type?
48
- return if prefer_string? && queue_name.str_type?
53
+ add_offense(queue_name, message: (prefer_symbol? ? MSG : MSG_STRING)) do |corrector|
54
+ content, _other = *queue_name
55
+ fix = prefer_symbol? ? ":#{content}" : content.to_s.inspect
49
56
 
50
- add_offense(queue_name, message: (prefer_symbol? ? MSG : MSG_STRING)) do |corrector|
51
- content, _other = *queue_name
52
- fix = prefer_symbol? ? ":#{content}" : content.to_s.inspect
53
-
54
- corrector.replace(queue_name, fix)
57
+ corrector.replace(queue_name, fix)
58
+ end
55
59
  end
56
60
  end
57
61
 
58
62
  private
59
63
 
60
- def prefer_symbol?
61
- !cop_config.fetch('QueueNameAs', 'Symbol').casecmp('string').zero?
64
+ def queue_names(node)
65
+ return [node.first_argument].compact unless node.block_node
66
+
67
+ # The queue is computed at runtime, so only the literals the block can return are checked.
68
+ possible_return_values(node.block_node.body).select { |value| value&.type?(:sym, :str) }
62
69
  end
63
70
 
64
- def prefer_string?
65
- !prefer_symbol?
71
+ def possible_return_values(node)
72
+ return [node] unless node
73
+
74
+ case node.type
75
+ when :begin then possible_return_values(node.children.last)
76
+ when :if then [node.if_branch, node.else_branch].flat_map { |branch| possible_return_values(branch) }
77
+ when :case then possible_case_return_values(node)
78
+ else [node]
79
+ end
80
+ end
81
+
82
+ def possible_case_return_values(node)
83
+ branches = node.when_branches.map(&:body) + [node.else_branch]
84
+ branches.flat_map { |branch| possible_return_values(branch) }
85
+ end
86
+
87
+ def preferred_style?(queue_name)
88
+ prefer_symbol? ? queue_name.sym_type? : queue_name.str_type?
89
+ end
90
+
91
+ def prefer_symbol?
92
+ !cop_config.fetch('QueueNameAs', 'Symbol').casecmp('string').zero?
66
93
  end
67
94
  end
68
95
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubocop'
4
+
5
+ module RuboCop
6
+ module Cop
7
+ module Carwow
8
+ class NoStubbingHoneycombExtraData < ::RuboCop::Cop::Base
9
+ MSG = "Don't stub or spy on `append_extra_honeycomb_data`. Other code (ActiveSupport::Notifications " \
10
+ 'subscribers, product area tagging, Faraday middleware) appends to the same store, so expectations ' \
11
+ 'on individual calls break when calls are split, merged or reordered. Do the work, then assert ' \
12
+ "on the data instead: `expect('some.key' => value).to have_been_appended_to_honeycomb_event`, " \
13
+ "or `expect { perform }.to append_to_honeycomb_event('some.key' => value)` to only check what " \
14
+ 'the block appended. Both come from `CarwowCore::Spec::HoneycombHelper` in `carwow_core/spec`.'
15
+
16
+ RESTRICT_ON_SEND = %i[receive have_received receive_messages].freeze
17
+
18
+ def_node_matcher :stubs_append?, <<~PATTERN
19
+ {
20
+ (send nil? {:receive :have_received} {(sym :append_extra_honeycomb_data) (str "append_extra_honeycomb_data")})
21
+ (send nil? :receive_messages (hash <(pair (sym :append_extra_honeycomb_data) _) ...>))
22
+ }
23
+ PATTERN
24
+
25
+ def on_send(node)
26
+ add_offense(node) if stubs_append?(node)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carwow_rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.8.0
4
+ version: 6.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - carwow Developers
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-08-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -98,22 +97,16 @@ dependencies:
98
97
  name: rubocop-rspec
99
98
  requirement: !ruby/object:Gem::Requirement
100
99
  requirements:
101
- - - ">="
100
+ - - "~>"
102
101
  - !ruby/object:Gem::Version
103
102
  version: '3.2'
104
- - - "<"
105
- - !ruby/object:Gem::Version
106
- version: '3.6'
107
103
  type: :runtime
108
104
  prerelease: false
109
105
  version_requirements: !ruby/object:Gem::Requirement
110
106
  requirements:
111
- - - ">="
107
+ - - "~>"
112
108
  - !ruby/object:Gem::Version
113
109
  version: '3.2'
114
- - - "<"
115
- - !ruby/object:Gem::Version
116
- version: '3.6'
117
110
  - !ruby/object:Gem::Dependency
118
111
  name: rubocop-factory_bot
119
112
  requirement: !ruby/object:Gem::Requirement
@@ -171,14 +164,15 @@ files:
171
164
  - lib/rubocop/cop/carwow/jobs_queue_name_style.rb
172
165
  - lib/rubocop/cop/carwow/no_change_matcher_with_browser_action.rb
173
166
  - lib/rubocop/cop/carwow/no_stubbing_business_event.rb
167
+ - lib/rubocop/cop/carwow/no_stubbing_honeycomb_extra_data.rb
174
168
  - lib/rubocop/cop/carwow/no_vehicle_brand_model_sideload.rb
175
169
  - lib/rubocop/cop/carwow/product_area_required.rb
176
170
  homepage: https://github.com/carwow/carwow_rubocop
177
171
  licenses:
178
172
  - MIT
179
173
  metadata:
174
+ allowed_push_host: https://rubygems.org
180
175
  rubygems_mfa_required: 'true'
181
- post_install_message:
182
176
  rdoc_options: []
183
177
  require_paths:
184
178
  - lib
@@ -193,8 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
187
  - !ruby/object:Gem::Version
194
188
  version: '0'
195
189
  requirements: []
196
- rubygems_version: 3.5.20
197
- signing_key:
190
+ rubygems_version: 3.6.9
198
191
  specification_version: 4
199
192
  summary: carwow's rubocop configuration
200
193
  test_files: []