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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80fac8c6082cae3bc4bf4d73610d0b3086211f2c79858f0d95688c9d6a45706e
4
- data.tar.gz: 7dfd7aaf518a70c45a3854b7230f4b15fd285f306872793ff93e610a45c15b59
3
+ metadata.gz: 91782f59f8a8101bb7e6d431d0e5f6e095ae6c4beed07485534bbf11406a32e3
4
+ data.tar.gz: 4d336df923e86b2f2f820f073e8813779452512912122de398ee2fd19a8c9d8b
5
5
  SHA512:
6
- metadata.gz: f56ad13635066d261bbad8a8d7b15fbb56d5f4bcb3df961f71dda2cb94d0d631c4673a4dc2f369eba773c7250e60b35ca3f62089537c59957affcf41b67b3392
7
- data.tar.gz: d9fcb710be612d1478c0c5e5c87c5bfd9c72275f4554521af6dd36adce6183e63057ce9dc330614f7bb6c11ac6950e03267cecffcef9dd45eddfde2ea67e288c
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 = <<-DOC.freeze
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.children.first)
29
+ add_offense(node.identifier)
30
30
  end
31
31
 
32
32
  private
33
33
 
34
34
  def has_perform_method?(node)
35
- node.descendants.find { |n| is_perform_method?(n) }
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.0
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-08-24 00:00:00.000000000 Z
11
+ date: 2022-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop