rubocop-betterment 1.14.0 → 1.15.0

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: 72ecfa7e731527b0864a131730eb79829789b2b34647dd73ed6b17bdc5c5e630
4
- data.tar.gz: 5337dbddc978a69778f40dde95c9136e83df54bf90e5b5eb122aaa925cf14e97
3
+ metadata.gz: 9b851af1c0666fffea3f63f36504e7acf1c6d6324e58caba76bcea50ac752f50
4
+ data.tar.gz: 6dcbd29396beb9c7310f6ff9082ae9494219741fb17b6306ea976747445e337e
5
5
  SHA512:
6
- metadata.gz: 9a1a2417233fd6494e0e4a99d4423fe0c1b051aaeb6e54cafe23791622f612afb48d169f06a4d23911a614fb19e937f3862743141915facc4bfdfbe64dd6bcd0
7
- data.tar.gz: f0beed1cf45c911d169061c703db710d05400da4ddc13cf16151338668bb023df9b98fe311e863caca8fa4979f099ab054ccf8c40eebac070ed52f6bf6a0135a
6
+ metadata.gz: 2067d92a8d52c91b76f3f42a470f852567f858ccc34b6ba0d50b0aa2c275ef8ba7b32287bf8592efbea39e18d1a7356ef375e51ffbddd6153d1809173ff5385c
7
+ data.tar.gz: 8d18894011ce90246f1cdaf5a8c42043df0c6dcd7a92bf9af6407c300c9c01cdd1d2c4ebe941ed26b4eb09500b0abb45f4d59d1286ee1eb622f3a75b2003dff0
@@ -7,3 +7,4 @@ require 'rubocop/cop/betterment/memoization_with_arguments'
7
7
  require 'rubocop/cop/betterment/site_prism_loaded'
8
8
  require 'rubocop/cop/betterment/spec_helper_required_outside_spec_dir'
9
9
  require 'rubocop/cop/betterment/implicit_redirect_type'
10
+ require 'rubocop/cop/betterment/active_job_performable'
@@ -0,0 +1,40 @@
1
+ module RuboCop
2
+ module Cop
3
+ module Betterment
4
+ class ActiveJobPerformable < Cop
5
+ MSG = <<-DOC.freeze
6
+ Classes that are "performable" should be ActiveJobs
7
+
8
+ class MyJob < ApplicationJob
9
+ def perform
10
+ end
11
+ end
12
+
13
+ You can learn more about ActiveJob here:
14
+ https://guides.rubyonrails.org/active_job_basics.html
15
+ DOC
16
+
17
+ def_node_matcher :subclasses_application_job?, <<-PATTERN
18
+ (class (const ...) (const _ :ApplicationJob) ...)
19
+ PATTERN
20
+
21
+ def_node_matcher :is_perform_method?, <<-PATTERN
22
+ (def :perform ...)
23
+ PATTERN
24
+
25
+ def on_class(node)
26
+ return unless has_perform_method?(node)
27
+ return if subclasses_application_job?(node)
28
+
29
+ add_offense(node.children.first)
30
+ end
31
+
32
+ private
33
+
34
+ def has_perform_method?(node)
35
+ node.descendants.find(&method(:is_perform_method?))
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-betterment
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Development
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-01 00:00:00.000000000 Z
11
+ date: 2020-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -91,6 +91,7 @@ files:
91
91
  - STYLEGUIDE.md
92
92
  - config/default.yml
93
93
  - lib/rubocop/cop/betterment.rb
94
+ - lib/rubocop/cop/betterment/active_job_performable.rb
94
95
  - lib/rubocop/cop/betterment/authorization_in_controller.rb
95
96
  - lib/rubocop/cop/betterment/dynamic_params.rb
96
97
  - lib/rubocop/cop/betterment/implicit_redirect_type.rb
@@ -118,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  - !ruby/object:Gem::Version
119
120
  version: '0'
120
121
  requirements: []
121
- rubygems_version: 3.1.4
122
+ rubygems_version: 3.1.3
122
123
  signing_key:
123
124
  specification_version: 4
124
125
  summary: Betterment rubocop configuration