rubocop-petal 0.4.1 → 0.6.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 +4 -4
- data/CHANGELOG.md +11 -2
- data/Gemfile.lock +3 -3
- data/config/default.yml +7 -0
- data/lib/rubocop/cop/rspec/sidekiq_inline.rb +37 -0
- data/lib/rubocop/petal/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7d73cfbe6b4f194f1c60d25235331cf7a08b04b516411efeabeafce9e6e7886
|
4
|
+
data.tar.gz: 193dd79a6efd61cdd2edbb5bfae7158497ca7cc2bb52da38b02dfecd776eadfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15ef827ea4cf56872e2c85178463e2d3a05a6a47411832439c81cb4dd9a9ff9221efb61603d2a9e6b38d5859fe0aa2745499bd1d98ef516169e1947065bf1ebb
|
7
|
+
data.tar.gz: 0c14a8c68e7af71afbd81cd827fdd76dfbcc8780e06ab7f1f2f662cc7409fe505b2afc05fa6260f18c6d3a1dd8df05176d51c965c71b68c4f75501abe4a9aa96
|
data/CHANGELOG.md
CHANGED
@@ -2,11 +2,20 @@
|
|
2
2
|
|
3
3
|
# main
|
4
4
|
|
5
|
-
#v0.
|
5
|
+
# v0.6.0
|
6
|
+
|
7
|
+
* Added cop `RSpec::SidekiqInline` ([#24](https://github.com/petalmd/rubocop-petal/pull/24))
|
8
|
+
* Remove cop `Rails/ValidateUniquenessCase` ([#21](https://github.com/petalmd/rubocop-petal/pull/21))
|
9
|
+
|
10
|
+
# v0.5.0
|
11
|
+
|
12
|
+
* Added cop `Rails/ValidateUniquenessCase` ([#20](https://github.com/petalmd/rubocop-petal/pull/20))
|
13
|
+
|
14
|
+
# v0.4.1
|
6
15
|
|
7
16
|
* Fix typo default config SafeAutoCorrect RSpec/StubProducts ([#19](https://github.com/petalmd/rubocop-petal/pull/19))
|
8
17
|
|
9
|
-
#v0.4.0
|
18
|
+
# v0.4.0
|
10
19
|
|
11
20
|
* Added cop `RSpec/StubProducts` ([#18](https://github.com/petalmd/rubocop-petal/pull/18))
|
12
21
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-petal (0.
|
4
|
+
rubocop-petal (0.6.0)
|
5
5
|
rubocop (>= 1.7.0, < 2.0)
|
6
6
|
rubocop-rails (~> 2.10)
|
7
7
|
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
parallel (1.21.0)
|
23
23
|
parser (3.0.3.2)
|
24
24
|
ast (~> 2.4.1)
|
25
|
-
rack (
|
25
|
+
rack (3.0.0)
|
26
26
|
rainbow (3.0.0)
|
27
27
|
rake (13.0.6)
|
28
28
|
regexp_parser (2.2.0)
|
@@ -51,7 +51,7 @@ GEM
|
|
51
51
|
unicode-display_width (>= 1.4.0, < 3.0)
|
52
52
|
rubocop-ast (1.15.0)
|
53
53
|
parser (>= 3.0.1.1)
|
54
|
-
rubocop-rails (2.
|
54
|
+
rubocop-rails (2.15.2)
|
55
55
|
activesupport (>= 4.2.0)
|
56
56
|
rack (>= 1.1)
|
57
57
|
rubocop (>= 1.7.0, < 2.0)
|
data/config/default.yml
CHANGED
@@ -30,6 +30,13 @@ RSpec/CreateListMax:
|
|
30
30
|
Include:
|
31
31
|
- spec/**/*
|
32
32
|
|
33
|
+
RSpec/SidekiqInline:
|
34
|
+
Description: 'Prevent using `Sidekiq::Testing.inline!` in spec in favor of stubbing and calling it inline with `new.perform`.'
|
35
|
+
Enabled: pending
|
36
|
+
StyleGuide: https://github.com/mperham/sidekiq/issues/3495
|
37
|
+
Include:
|
38
|
+
- spec/**/*
|
39
|
+
|
33
40
|
RSpec/StubProducts:
|
34
41
|
Description: 'Suggest to use stub_products instead of veil/unveil_product.'
|
35
42
|
Enabled: true
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module RSpec
|
6
|
+
# Prevent using `Sidekiq::Testing.inline!` in spec.
|
7
|
+
# The method will execute inline every perform_async called.
|
8
|
+
# Must likely a spec want to test a specific worker and called it.
|
9
|
+
# If you don't need to execute it, consider using `have_enqueued_sidekiq_job`
|
10
|
+
# matcher.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# # bad
|
14
|
+
# Sidekiq::Testing.inline! do; end
|
15
|
+
#
|
16
|
+
# # good
|
17
|
+
# expect(MyWorker).to receive(:perform_async).with(some_id) do |id|
|
18
|
+
# MyWorker.new.perform(id)
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
class SidekiqInline < Base
|
22
|
+
MSG = 'Stub `perform_async` and call inline worker with `new.perform`.'
|
23
|
+
RESTRICT_ON_SEND = [:inline!].freeze
|
24
|
+
|
25
|
+
def_node_matcher :sidekiq_inline?, <<~PATTERN
|
26
|
+
(send (const (const _ :Sidekiq) :Testing) :inline!)
|
27
|
+
PATTERN
|
28
|
+
|
29
|
+
def on_send(node)
|
30
|
+
return unless sidekiq_inline?(node)
|
31
|
+
|
32
|
+
add_offense(node)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Francis Bastien
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '2.10'
|
47
|
-
description:
|
47
|
+
description:
|
48
48
|
email:
|
49
49
|
- jfbastien@petalmd.com
|
50
50
|
executables: []
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- lib/rubocop/cop/rails/table_name.rb
|
78
78
|
- lib/rubocop/cop/rspec/authenticated_as.rb
|
79
79
|
- lib/rubocop/cop/rspec/create_list_max.rb
|
80
|
+
- lib/rubocop/cop/rspec/sidekiq_inline.rb
|
80
81
|
- lib/rubocop/cop/rspec/stub_products.rb
|
81
82
|
- lib/rubocop/petal.rb
|
82
83
|
- lib/rubocop/petal/inject.rb
|
@@ -89,7 +90,7 @@ metadata:
|
|
89
90
|
homepage_uri: https://github.com/petalmd/rubocop-petal
|
90
91
|
source_code_uri: https://github.com/petalmd/rubocop-petal
|
91
92
|
rubygems_mfa_required: 'true'
|
92
|
-
post_install_message:
|
93
|
+
post_install_message:
|
93
94
|
rdoc_options: []
|
94
95
|
require_paths:
|
95
96
|
- lib
|
@@ -104,8 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
105
|
- !ruby/object:Gem::Version
|
105
106
|
version: '0'
|
106
107
|
requirements: []
|
107
|
-
rubygems_version: 3.
|
108
|
-
signing_key:
|
108
|
+
rubygems_version: 3.0.3
|
109
|
+
signing_key:
|
109
110
|
specification_version: 4
|
110
111
|
summary: Petal custom cops
|
111
112
|
test_files: []
|