rubocop-obsession 0.1.12 → 0.1.14
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 +4 -4
- data/lib/rubocop/cop/obsession/mixin/helpers.rb +33 -0
- data/lib/rubocop/cop/obsession/rails/service_perform_method.rb +1 -1
- data/lib/rubocop/obsession/version.rb +1 -1
- data/lib/rubocop/obsession.rb +1 -1
- metadata +4 -4
- data/lib/rubocop/cop/mixin/helpers.rb +0 -31
- /data/lib/rubocop/cop/{mixin → obsession/mixin}/files/verbs.txt +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37b348efda2df448308744549f3a30181b44839d436a5219356579ef319ce8a4
|
4
|
+
data.tar.gz: 3ad138c089db20056117e20650f844de403253b147a35c2286eebbaef7c06faf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee4ef4d270d3c6a33592370ada26298c81a8a1319fde90ae047bec81c87fe1732ed20a5bacc8ec969bcb52b9e2adfa2f440a28e7454f65f370bb225b91b75143
|
7
|
+
data.tar.gz: 378bf2513dedcb169400b5d0028775a3d330b576f5c520e3b4ff1e9ca27a658f8c15a7ab5ef3bc282e950527559d7d37b93eeba9c842dd77a4b667273d9ef170
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Obsession
|
6
|
+
module Helpers
|
7
|
+
def rails_callback?(callback)
|
8
|
+
return true if callback == 'validate'
|
9
|
+
|
10
|
+
callback.match?(
|
11
|
+
/
|
12
|
+
^(before|after|around)
|
13
|
+
_.*
|
14
|
+
(action|validation|create|update|save|destroy|commit|rollback)$
|
15
|
+
/x
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def verb?(string)
|
20
|
+
short_string = string[2..] if string.start_with?('re')
|
21
|
+
|
22
|
+
verbs.include?(string) || verbs.include?(short_string)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def verbs
|
28
|
+
@@verbs ||= File.read("#{__dir__}/files/verbs.txt").split
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -46,7 +46,7 @@ module RuboCop
|
|
46
46
|
|
47
47
|
if method.method_name != :perform
|
48
48
|
add_offense(method) do |corrector|
|
49
|
-
corrector.replace(method, method.source.sub(
|
49
|
+
corrector.replace(method, method.source.sub(method.method_name.to_s, 'perform'))
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
data/lib/rubocop/obsession.rb
CHANGED
@@ -3,7 +3,7 @@ require 'active_support/core_ext/object/blank'
|
|
3
3
|
require 'active_support/core_ext/string/inflections'
|
4
4
|
require 'rubocop'
|
5
5
|
|
6
|
-
require_relative 'cop/mixin/helpers'
|
6
|
+
require_relative 'cop/obsession/mixin/helpers'
|
7
7
|
Dir["#{__dir__}/cop/obsession/**/*.rb"].sort.each { |file| require file }
|
8
8
|
require_relative 'obsession/version'
|
9
9
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-obsession
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerome Dalbert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -48,10 +48,10 @@ files:
|
|
48
48
|
- LICENSE.txt
|
49
49
|
- README.md
|
50
50
|
- config/default.yml
|
51
|
-
- lib/rubocop/cop/mixin/files/verbs.txt
|
52
|
-
- lib/rubocop/cop/mixin/helpers.rb
|
53
51
|
- lib/rubocop/cop/obsession/graphql/mutation_name.rb
|
54
52
|
- lib/rubocop/cop/obsession/method_order.rb
|
53
|
+
- lib/rubocop/cop/obsession/mixin/files/verbs.txt
|
54
|
+
- lib/rubocop/cop/obsession/mixin/helpers.rb
|
55
55
|
- lib/rubocop/cop/obsession/no_break_or_next.rb
|
56
56
|
- lib/rubocop/cop/obsession/no_paragraphs.rb
|
57
57
|
- lib/rubocop/cop/obsession/no_todos.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Cop
|
5
|
-
module Helpers
|
6
|
-
def rails_callback?(callback)
|
7
|
-
return true if callback == 'validate'
|
8
|
-
|
9
|
-
callback.match?(
|
10
|
-
/
|
11
|
-
^(before|after|around)
|
12
|
-
_.*
|
13
|
-
(action|validation|create|update|save|destroy|commit|rollback)$
|
14
|
-
/x
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
def verb?(string)
|
19
|
-
short_string = string[2..] if string.start_with?('re')
|
20
|
-
|
21
|
-
verbs.include?(string) || verbs.include?(short_string)
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def verbs
|
27
|
-
@@verbs ||= File.read("#{__dir__}/files/verbs.txt").split
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
File without changes
|