rubocop-ordered_methods 0.12 → 0.13

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: a73cfd25f43f431101b9822358b1c59180d41a56f170bf614d7ec0149f4f2c3e
4
- data.tar.gz: 3c470834560d76327fc38f4163284ab4131214d8b944f0ffe34ede2e4164caab
3
+ metadata.gz: b4d888d565f892bba920e148aa967920188045908a193d44a7a1e672fc713a66
4
+ data.tar.gz: 70396bfc0679f49119a78b1e6e62d6b85492c308b93e31738c4148117a3ec6ec
5
5
  SHA512:
6
- metadata.gz: a2600cc2de26566766baf34796941c5056340e3bd9ccc1e9eb30ee73b6d57aa315a2f290e641c2128e9089956415fc0f79d0a0b8dd300df02af5a73b238037e9
7
- data.tar.gz: f7c14e935cbfae83760f4724292db502f9bed264e3c77c1d99c51d5d3ca4e6c948b46fedc8dbbbd32906d721dcaf310597160b2bc148b4bee06725f1c59119d3
6
+ metadata.gz: e41e772f903aae3b9d92278bd09d3568ccb189c56a5c0ffece2d0b79eb97b3e7f6f03142d04d2bef61265717b2253c4c825d9bb953d042b45bb8124aef30a99e
7
+ data.tar.gz: 82ef17c01433200a393bed3fa2c812addaeb059ffc99b76b9c85287b972618f32e2b62acdbbeabe014e61dff597a490519835ab8118f7a65ae9a2123e4418e48
@@ -16,6 +16,8 @@ jobs:
16
16
  - "3.0"
17
17
  - "3.1"
18
18
  - "3.2"
19
+ - "3.3"
20
+ - "3.4"
19
21
 
20
22
  name: "Ruby ${{ matrix.ruby }}: run rspec"
21
23
  steps:
@@ -35,6 +37,8 @@ jobs:
35
37
  - "3.0"
36
38
  - "3.1"
37
39
  - "3.2"
40
+ - "3.3"
41
+ - "3.4"
38
42
 
39
43
  name: "Ruby ${{ matrix.ruby }}: run rubocop"
40
44
  steps:
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.13] - 2024-10-01
10
+
11
+ ### Fixed
12
+
13
+ - Fix clobbering when consecutive nodes are with wrong order [#17](https://github.com/shanecav84/rubocop-ordered_methods/pull/17). Thanks, @Darhazer.
14
+
9
15
  ## [0.12] - 2024-07-16
10
16
 
11
17
  ### Fixed
@@ -50,25 +50,33 @@ module RuboCop
50
50
 
51
51
  def on_begin(node)
52
52
  start_node = node.children.find(&:class_type?)&.children&.last || node
53
+ check(start_node)
54
+ end
55
+
56
+ private
57
+
58
+ def access_modified?(node, is_class_method_block)
59
+ (node.defs_type? && !is_class_method_block) ||
60
+ (node.def_type? && is_class_method_block) ||
61
+ (node.send_type? && node.bare_access_modifier?)
62
+ end
63
+
64
+ def check(start_node)
53
65
  consecutive_methods(start_node.children) do |previous, current|
54
66
  next if ordered?(previous, current)
55
67
 
56
68
  add_offense(current, message: message) do |corrector|
69
+ next if part_of_ignored_node?(previous)
70
+
57
71
  OrderedMethodsCorrector.new(
58
72
  processed_source.ast_with_comments, start_node.children, cop_config
59
73
  ).correct(current, previous, corrector)
74
+
75
+ ignore_node(current)
60
76
  end
61
77
  end
62
78
  end
63
79
 
64
- private
65
-
66
- def access_modified?(node, is_class_method_block)
67
- (node.defs_type? && !is_class_method_block) ||
68
- (node.def_type? && is_class_method_block) ||
69
- (node.send_type? && node.bare_access_modifier?)
70
- end
71
-
72
80
  # We disable `Style/ExplicitBlockArgument` for performance. See
73
81
  # https://github.com/shanecav84/rubocop-ordered_methods/pull/5#pullrequestreview-562957146
74
82
  # rubocop:disable Style/ExplicitBlockArgument
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'rubocop-ordered_methods'
8
- spec.version = '0.12'
8
+ spec.version = '0.13'
9
9
  spec.authors = ['Shane Cavanaugh']
10
10
  spec.email = ['shane@shanecav.net']
11
11
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-ordered_methods
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.12'
4
+ version: '0.13'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Cavanaugh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-16 00:00:00.000000000 Z
11
+ date: 2024-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop