rubocop-petal 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f457dc147b37b31a89fc5f511560442983a438b191e5723fe95d981f8cb32e91
|
4
|
+
data.tar.gz: 197112fd588a74778acc75c2d0da8238dcc4681c49636b5ed7a543728b0abe97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a455e3b3db660c5fa02a148263582aee5e82ad561638d8094f2beff087c08eb0e8414e45f2eccd4f1bbaa7d8740e41317fb5421dea0a9e39a41fbc947cb65f49
|
7
|
+
data.tar.gz: f89c1da3350fccba89c879092bfb8734f2a903714017cf177e24183a3bb44864c86c90ab1648bb9a5cf8cf0f0347b7dc2f4bfdebb139a684ac9a45b7af5676a7
|
data/config/default.yml
CHANGED
@@ -78,13 +78,6 @@ Chewy/ResetOnType:
|
|
78
78
|
Description: 'Prevent using reset! methods on Chewy type class'
|
79
79
|
Enabled: true
|
80
80
|
|
81
|
-
RSpec/JsonParseResponseBody:
|
82
|
-
Description: 'Prevent JSON.parse(response.body) in favor of response.parsed_body'
|
83
|
-
Enabled: true
|
84
|
-
SafeAutoCorrect: true
|
85
|
-
Include:
|
86
|
-
- spec/**/*
|
87
|
-
|
88
81
|
RSpec/JsonResponse:
|
89
82
|
Description: 'Prevent json_response in favor of response.parsed_body'
|
90
83
|
Enabled: true
|
@@ -7,19 +7,21 @@ module RuboCop
|
|
7
7
|
# The method will execute inline every perform_async called.
|
8
8
|
# Must likely a spec want to test a specific worker and called it.
|
9
9
|
# If you don't need to execute it, consider using `have_enqueued_sidekiq_job`
|
10
|
-
# matcher.
|
10
|
+
# matcher. Or if you need to perform the jobs in queue for this worker, use
|
11
|
+
# `drain` method on the worker class.
|
11
12
|
#
|
12
13
|
# @example
|
13
14
|
# # bad
|
14
|
-
# Sidekiq::Testing.inline! do
|
15
|
+
# Sidekiq::Testing.inline! do
|
16
|
+
# OperationThatTriggerWorker.call(some_id)
|
17
|
+
# end
|
15
18
|
#
|
16
19
|
# # good
|
17
|
-
#
|
18
|
-
#
|
19
|
-
# end
|
20
|
+
# OperationThatTriggerWorker.call(some_id)
|
21
|
+
# MyWorker.drain
|
20
22
|
#
|
21
23
|
class SidekiqInline < Base
|
22
|
-
MSG = '
|
24
|
+
MSG = 'Use `MyWorker.drain` method instead of `Sidekiq::Testing.inline!`.'
|
23
25
|
RESTRICT_ON_SEND = [:inline!].freeze
|
24
26
|
|
25
27
|
def_node_matcher :sidekiq_inline?, <<~PATTERN
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-petal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Francis Bastien
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -70,7 +70,6 @@ files:
|
|
70
70
|
- lib/rubocop/cop/rails/table_name.rb
|
71
71
|
- lib/rubocop/cop/rspec/authenticated_as.rb
|
72
72
|
- lib/rubocop/cop/rspec/create_list_max.rb
|
73
|
-
- lib/rubocop/cop/rspec/json_parse_response_body.rb
|
74
73
|
- lib/rubocop/cop/rspec/json_response.rb
|
75
74
|
- lib/rubocop/cop/rspec/sidekiq_inline.rb
|
76
75
|
- lib/rubocop/cop/rspec/stub_products.rb
|
@@ -101,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
100
|
- !ruby/object:Gem::Version
|
102
101
|
version: '0'
|
103
102
|
requirements: []
|
104
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.2.3
|
105
104
|
signing_key:
|
106
105
|
specification_version: 4
|
107
106
|
summary: Petal custom cops
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Cop
|
5
|
-
module RSpec
|
6
|
-
# Prevent using `JSON.parse(response.body)` in spec.
|
7
|
-
# Consider using `response.parsed_body`.
|
8
|
-
#
|
9
|
-
# @example
|
10
|
-
# # bad
|
11
|
-
# JSON.parse(response.body) do; end
|
12
|
-
#
|
13
|
-
# # good
|
14
|
-
# response.parsed_body
|
15
|
-
#
|
16
|
-
class JsonParseResponseBody < Base
|
17
|
-
extend AutoCorrector
|
18
|
-
|
19
|
-
MSG = 'Use `response.parsed_body` instead.'
|
20
|
-
|
21
|
-
def_node_matcher :json_parse_response_body?, <<~PATTERN
|
22
|
-
(send (const _ :JSON) :parse (send (send _ :response) :body))
|
23
|
-
PATTERN
|
24
|
-
|
25
|
-
def on_send(node)
|
26
|
-
return unless json_parse_response_body?(node)
|
27
|
-
|
28
|
-
add_offense(node) do |corrector|
|
29
|
-
corrector.replace(node, 'response.parsed_body')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|