rubocop-betterment 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b851af1c0666fffea3f63f36504e7acf1c6d6324e58caba76bcea50ac752f50
|
4
|
+
data.tar.gz: 6dcbd29396beb9c7310f6ff9082ae9494219741fb17b6306ea976747445e337e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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-
|
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.
|
122
|
+
rubygems_version: 3.1.3
|
122
123
|
signing_key:
|
123
124
|
specification_version: 4
|
124
125
|
summary: Betterment rubocop configuration
|