rubocop-obsession 0.1.8 → 0.1.10

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: d393d8af056f32d108c9c0f272cf6a6ccf2158d33caf91a950ca317f9da2a9cb
4
- data.tar.gz: 822e9f0697a1559eb91755d9f2702a9d121727c89e9715e9c48ab447ff702220
3
+ metadata.gz: ca08e6e52147f47ce8142c88d2e527551ebe9daba1469c0ca72e4e1903ac2b93
4
+ data.tar.gz: 7a2237521f066a0c04f7409b4f71cc2bc60c3a5df0648edeedb5ba655cf80abd
5
5
  SHA512:
6
- metadata.gz: 9dc017470f824de21567bf7ec06ea9e372f5edc147932f715e8bdb3a8b60ef6cdfb1a84905b33c9ae0e340cf8515455e59374ec22121c6b4b36296204527918d
7
- data.tar.gz: d4a5f84c5714d34ae2733e4f13fb58a089955d83c546ff411a34614bf2178a749f8acd1fc31bd4cbacb3d6fd5d85b24a0648fb7545f44a7a60110d1aa194494f
6
+ metadata.gz: c29e19de87c89fffd4d02c17082d82a1cc4fa6d66f710f2bbfe1637badc2a30bb67ebc7d6e459537a0980ee1c361fa3543c259f1c48d22ce771d205aa5f6a097
7
+ data.tar.gz: 58bdbd117cb731304db523fc53deb7dfed033bd96260fd58a123ba1afb6d668df0b53e73e13a32f2d8928b055322872966192822512c23ebe2fb2bd2a0c73597
data/config/default.yml CHANGED
@@ -127,11 +127,11 @@ Layout/ClassStructure:
127
127
  - after_destroy_commit
128
128
  - around_create
129
129
  other_macros:
130
- - devise
131
130
  - acts_as_paranoid
132
- - serialize
133
- - has_paper_trail
134
131
  - audited
132
+ - devise
133
+ - has_paper_trail
134
+ - serialize
135
135
  scopes:
136
136
  - default_scope
137
137
  - scope
@@ -3,8 +3,6 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Helpers
6
- VERBS = File.read("#{__dir__}/files/verbs.txt").split
7
-
8
6
  def rails_callback?(callback)
9
7
  return true if callback == 'validate'
10
8
 
@@ -20,7 +18,13 @@ module RuboCop
20
18
  def verb?(string)
21
19
  short_string = string[2..] if string.start_with?('re')
22
20
 
23
- VERBS.include?(string) || VERBS.include?(short_string)
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
24
28
  end
25
29
  end
26
30
  end
@@ -41,11 +41,9 @@ module RuboCop
41
41
 
42
42
  def on_block(node)
43
43
  return if !safety_assured_block?(node)
44
- previous_comment = processed_source.comments_before_line(node.first_line)&.first
44
+ comment = processed_source.ast_with_comments[node].map(&:text).join("\n")
45
45
 
46
- if previous_comment.nil? || !previous_comment.text.match?(/^# Safe because( [^ ]+){4}/)
47
- add_offense(node)
48
- end
46
+ add_offense(node) if !comment.match?(/^# Safe because( [^ ]+){4}/)
49
47
  end
50
48
  end
51
49
  end
@@ -1,5 +1,5 @@
1
1
  module Rubocop
2
2
  module Obsession
3
- VERSION = '0.1.8'
3
+ VERSION = '0.1.10'
4
4
  end
5
5
  end
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.8
4
+ version: 0.1.10
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-05 00:00:00.000000000 Z
11
+ date: 2024-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.5.16
96
+ rubygems_version: 3.5.23
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: High-level code style checking for Ruby files.