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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80fac8c6082cae3bc4bf4d73610d0b3086211f2c79858f0d95688c9d6a45706e
4
- data.tar.gz: 7dfd7aaf518a70c45a3854b7230f4b15fd285f306872793ff93e610a45c15b59
3
+ metadata.gz: d3c9bfec949a3d8c5fe6f8bd9346def3b15776406b4e47e787b2d3f3ec531896
4
+ data.tar.gz: e38dd2adeb14b5bc887fdbd4abdf08aae9e30b889b3f9610fbd328c0bf7adcb5
5
5
  SHA512:
6
- metadata.gz: f56ad13635066d261bbad8a8d7b15fbb56d5f4bcb3df961f71dda2cb94d0d631c4673a4dc2f369eba773c7250e60b35ca3f62089537c59957affcf41b67b3392
7
- data.tar.gz: d9fcb710be612d1478c0c5e5c87c5bfd9c72275f4554521af6dd36adce6183e63057ce9dc330614f7bb6c11ac6950e03267cecffcef9dd45eddfde2ea67e288c
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 = <<-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,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.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.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.0
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-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