betterlint 1.2.0 → 1.2.2
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 +14 -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: d3c9bfec949a3d8c5fe6f8bd9346def3b15776406b4e47e787b2d3f3ec531896
|
4
|
+
data.tar.gz: e38dd2adeb14b5bc887fdbd4abdf08aae9e30b889b3f9610fbd328c0bf7adcb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d715a22437ca55e04429d69425f134e7258b3b9c3a8d7053e0b0f413846d0da9063131f155bc11d730b9c5f77aa1dde18922e28f7d98a9bacfc306f8cc806a6
|
7
|
+
data.tar.gz: ff3c967e3b83c9abb23d5f9e7b81f1920bf90b9debe5ca14dfd9e314268d82e0a1941df9834c1661b4a738a21b68c038e7709ee19810bb24b733dd44610bbe53
|
@@ -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,26 @@ 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.nil?
|
40
|
+
[]
|
41
|
+
elsif node.body.begin_type?
|
42
|
+
node.body.children
|
43
|
+
else
|
44
|
+
[node.body]
|
45
|
+
end
|
36
46
|
end
|
37
47
|
end
|
38
48
|
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.2
|
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
|