betterlint 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubocop/cop/betterment/active_job_performable.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91782f59f8a8101bb7e6d431d0e5f6e095ae6c4beed07485534bbf11406a32e3
|
4
|
+
data.tar.gz: 4d336df923e86b2f2f820f073e8813779452512912122de398ee2fd19a8c9d8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc5684ed82435f46ca36e99fa251073489ce870f15c9bb1484b43b4901049b1313fe6c5995fba020b0db717f0ebcac729ed09a68e889c25d4c148602da13a778
|
7
|
+
data.tar.gz: '08c7298e7cd72fff069fe3870b2f853816658ddafe9871b86c957eae8d5aa218e8893381db8fac530160c1cc7f920bcff1aabc67d4ab2bd2e9d77db6705ba8be'
|
@@ -2,7 +2,7 @@ module RuboCop
|
|
2
2
|
module Cop
|
3
3
|
module Betterment
|
4
4
|
class ActiveJobPerformable < Cop
|
5
|
-
MSG =
|
5
|
+
MSG = <<~DOC.freeze
|
6
6
|
Classes that are "performable" should be ActiveJobs
|
7
7
|
|
8
8
|
class MyJob < ApplicationJob
|
@@ -23,16 +23,24 @@ module RuboCop
|
|
23
23
|
PATTERN
|
24
24
|
|
25
25
|
def on_class(node)
|
26
|
-
return unless has_perform_method?(node)
|
27
26
|
return if subclasses_application_job?(node)
|
27
|
+
return unless has_perform_method?(node)
|
28
28
|
|
29
|
-
add_offense(node.
|
29
|
+
add_offense(node.identifier)
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
33
33
|
|
34
34
|
def has_perform_method?(node)
|
35
|
-
node.
|
35
|
+
possible_methods_within(node).any? { |n| is_perform_method?(n) }
|
36
|
+
end
|
37
|
+
|
38
|
+
def possible_methods_within(node)
|
39
|
+
if node.body.begin_type?
|
40
|
+
node.body.children
|
41
|
+
else
|
42
|
+
[node.body]
|
43
|
+
end
|
36
44
|
end
|
37
45
|
end
|
38
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: betterlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Development
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|