rubocop-obsession 0.1.12 → 0.1.14

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: 799bc0f4a5060b91a26dc8b75b2ecf442e66c4956bcbe78f245e070cc26e2e94
4
- data.tar.gz: 1ed8f6958eb2953939825077bb251d86d1270634b042cca54a13eb90e740d1fd
3
+ metadata.gz: 37b348efda2df448308744549f3a30181b44839d436a5219356579ef319ce8a4
4
+ data.tar.gz: 3ad138c089db20056117e20650f844de403253b147a35c2286eebbaef7c06faf
5
5
  SHA512:
6
- metadata.gz: 5204e24cd86b37dceaa338cda3a78ef501498726c1da4e39fd7b146c51d90a588c17f07516e3ee32591a3a6d48be27c34610227d26605badf5b3b7ea20c9c928
7
- data.tar.gz: '09ab0bf1a0cf21e4d15176482e9e4f4dba6633ed9c507844f4de1c9f1a892914a2690c5bbd4598a214fe4226159820965b8f26dda8893dd28340c4079269d07d'
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(/#{method.method_name}/, 'perform'))
49
+ corrector.replace(method, method.source.sub(method.method_name.to_s, 'perform'))
50
50
  end
51
51
  end
52
52
  end
@@ -1,5 +1,5 @@
1
1
  module Rubocop
2
2
  module Obsession
3
- VERSION = '0.1.12'
3
+ VERSION = '0.1.14'
4
4
  end
5
5
  end
@@ -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.12
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: 2024-11-27 00:00:00.000000000 Z
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