rubocop-ordered_methods 0.10 → 0.11

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: c43226dde578a4844ba7c579a7fa5dfb52f05dce2e84d9a68f1e250e272d4e58
4
- data.tar.gz: 636542d7c4be5982d3424703ba2062c72c4fdbfcf4f289a5b593050b68c16969
3
+ metadata.gz: 8136e162c37c297ad3e2eee09364841551f447b6854ada050b165d0286fda95d
4
+ data.tar.gz: 595fd69b9114f9122920cf5c8f15a1cb6a43b22f4c31ab9665a11bf2411ff91d
5
5
  SHA512:
6
- metadata.gz: 1eced8a7bb0e4a33bf58cae6b0b0d90fd9814318635689450ee34646905a5a41fbd97189c51d9763706f307d4ed4c3032e3eb02af2aa5ce79c373f12bd5f1019
7
- data.tar.gz: 4c528b7368611c20b2ab790f28502f3c44e4e6546bcbff35b199c749932583bdea36cc5d441e598efb7b7e199b63fbac97f50a6534b206052f60474ebe24147a
6
+ metadata.gz: ab8b3c4ae74ac44dc4ee43af04cdb3854f8df847113e499dc2d429843c4276a34084316edc3c0aca41fd4174fdd6c3a508a642ec8dbc19302e6c015bc65ee16e
7
+ data.tar.gz: 96347af9d20819c73c485e5a985702097ab5507ec86774ab144bf8f9fa54363461dc0a53f993429a6321e0e8fea6d0b4bcf244c9159b17a03fcf7f503b41ec75
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.11] - 2023-12-19
10
+
11
+ ### Fixed
12
+
13
+ - Fix handling require at the top of the file, nil nodes, and nodes that aren't of type AST::node ([#15](https://github.com/shanecav84/rubocop-ordered_methods/pull/15)). Thanks @rohitpaulk and @libmartinito
14
+
9
15
  ## [0.10] - 2021-03-10
10
16
 
11
17
  ### Removed
@@ -54,14 +54,15 @@ module RuboCop
54
54
  end
55
55
 
56
56
  def on_begin(node)
57
- siblings, _corrector = cache(node)
57
+ start_node = node.children.find(&:class_type?)&.children&.last || node
58
+ siblings, _corrector = cache(start_node)
59
+
58
60
  consecutive_methods(siblings) do |previous, current|
59
61
  unless ordered?(previous, current)
60
62
  @previous_node = previous
61
63
  add_offense(
62
64
  current,
63
- message: 'Methods should be sorted in ' \
64
- "#{cop_config['EnforcedStyle']} order."
65
+ message: "Methods should be sorted in #{cop_config['EnforcedStyle']} order."
65
66
  )
66
67
  end
67
68
  end
@@ -118,7 +119,8 @@ module RuboCop
118
119
  # rubocop:enable Style/ExplicitBlockArgument
119
120
 
120
121
  def filter_relevant_nodes(nodes)
121
- nodes.select do |node|
122
+ nodes.compact.select do |node|
123
+ next unless node.is_a?(Parser::AST::Node)
122
124
  relevant_node?(node) || (node.send_type? && qualifier_macro?(node))
123
125
  end
124
126
  end
@@ -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.10'
8
+ spec.version = '0.11'
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.10'
4
+ version: '0.11'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Cavanaugh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-14 00:00:00.000000000 Z
11
+ date: 2023-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop