rubocop-ast 0.8.0 → 1.0.1

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: d9e5dc8ddfc947af0653c81c0579c18eba59551567d977dc3bf0a4ca4ea92d59
4
- data.tar.gz: 4110b86811007a0a28e52c090f45b34449a0e3a6ede4cec97463052c1fb3a8a2
3
+ metadata.gz: d8575eee0ddbed5fb9eb553bbc33346ec8dc75216403501a46a946f825e79102
4
+ data.tar.gz: 5762b5f73e28c3dfd687feb0308d4248d87b90488ff99c9ddeebd49dced31941
5
5
  SHA512:
6
- metadata.gz: 827480d8986177910eee3a5d7bebafd9eb169818d755d79c16f9d4a3f89ebcd486494f35f07fbf3e0f6ffcc2a82da74a86b0475504c79b4fb1de3b3ad732a78f
7
- data.tar.gz: 6daa124ee67a95fbc6e91cf5cc0a1179e9aad6718fd8a3f9d54b48c5209b45ede07875e1becbdae84ee2106458bb23538fc144a8aefcc35e922204fcb4c30619
6
+ metadata.gz: c7b6f9c6f1366ec8ddcb852ce8af9abdd0f945d41c17c9221ea27e9442b324912a1ff530e9faa36a4d48242e282b5786095cf714b38180e6b9fb121e97f4d703
7
+ data.tar.gz: e43be065343ccc65a3c776b7073c6647c4cbf406121ec8e31782ced1b2d218937597f70a35b014d9c5681cdf7e76a8045755c4133394160ab3ed710e87639972
@@ -484,10 +484,11 @@ module RuboCop
484
484
  def_node_matcher :global_const?, '(const {nil? cbase} %1)'
485
485
 
486
486
  def_node_matcher :class_constructor?, <<~PATTERN
487
- { (send #global_const?({:Class :Module}) :new ...)
488
- (block (send #global_const?({:Class :Module}) :new ...) ...)}
487
+ { (send #global_const?({:Class :Module :Struct}) :new ...)
488
+ (block (send #global_const?({:Class :Module :Struct}) :new ...) ...)}
489
489
  PATTERN
490
490
 
491
+ # @deprecated Use `:class_constructor?`
491
492
  def_node_matcher :struct_constructor?, <<~PATTERN
492
493
  (block (send #global_const?(:Struct) :new ...) _ $_)
493
494
  PATTERN
@@ -174,7 +174,7 @@ module RuboCop
174
174
  # @return [Boolean] whether the dispatched method is a `def` modifier
175
175
  def def_modifier?
176
176
  send_type? &&
177
- [self, *each_descendant(:send)].any?(&:adjacent_def_modifier?)
177
+ adjacent_def_modifier? || each_child_node(:send).any?(&:def_modifier?)
178
178
  end
179
179
 
180
180
  # Checks whether this is a lambda. Some versions of parser parses
@@ -6,7 +6,7 @@ module RuboCop
6
6
  module AST
7
7
  # This class performs a pattern-matching operation on an AST node.
8
8
  #
9
- # Detailed syntax: /doc/modules/ROOT/pages/node_pattern.md
9
+ # Detailed syntax: /docs/modules/ROOT/pages/node_pattern.adoc
10
10
  #
11
11
  # Initialize a new `NodePattern` with `NodePattern.new(pattern_string)`, then
12
12
  # pass an AST node to `NodePattern#match`. Alternatively, use one of the class
@@ -6,7 +6,7 @@ module RuboCop
6
6
  # Responsible to build the AST nodes for `NodePattern`
7
7
  #
8
8
  # Doc on how this fits in the compiling process:
9
- # /doc/modules/ROOT/pages/node_pattern.md
9
+ # /docs/modules/ROOT/pages/node_pattern.adoc
10
10
  class Builder
11
11
  def emit_capture(capture_token, node)
12
12
  return node if capture_token.nil?
@@ -7,7 +7,7 @@ module RuboCop
7
7
  # Defers work to its subcompilers
8
8
  #
9
9
  # Doc on how this fits in the compiling process:
10
- # /doc/modules/ROOT/pages/node_pattern.md
10
+ # /docs/modules/ROOT/pages/node_pattern.adoc
11
11
  class Compiler
12
12
  extend Forwardable
13
13
  attr_reader :captures, :named_parameters, :positional_parameters, :binding
@@ -8,7 +8,7 @@ module RuboCop
8
8
  # This value responds to `===`.
9
9
  #
10
10
  # Doc on how this fits in the compiling process:
11
- # /doc/modules/ROOT/pages/node_pattern.md
11
+ # /docs/modules/ROOT/pages/node_pattern.adoc
12
12
  class AtomSubcompiler < Subcompiler
13
13
  private
14
14
 
@@ -9,7 +9,7 @@ module RuboCop
9
9
  # or it's `node.type` if `seq_head` is true
10
10
  #
11
11
  # Doc on how this fits in the compiling process:
12
- # /doc/modules/ROOT/pages/node_pattern.md
12
+ # /docs/modules/ROOT/pages/node_pattern.adoc
13
13
  class NodePatternSubcompiler < Subcompiler
14
14
  attr_reader :access, :seq_head
15
15
 
@@ -11,7 +11,7 @@ module RuboCop
11
11
  # Assumes the given `var` is a `::RuboCop::AST::Node`
12
12
  #
13
13
  # Doc on how this fits in the compiling process:
14
- # /doc/modules/ROOT/pages/node_pattern.md
14
+ # /docs/modules/ROOT/pages/node_pattern.adoc
15
15
  #
16
16
  # rubocop:disable Metrics/ClassLength
17
17
  class SequenceSubcompiler < Subcompiler
@@ -8,7 +8,7 @@ module RuboCop
8
8
  # Implements visitor pattern
9
9
  #
10
10
  # Doc on how this fits in the compiling process:
11
- # /doc/modules/ROOT/pages/node_pattern.md
11
+ # /docs/modules/ROOT/pages/node_pattern.adoc
12
12
  class Subcompiler
13
13
  attr_reader :compiler
14
14
 
@@ -14,7 +14,7 @@ module RuboCop
14
14
  # Lexer class for `NodePattern`
15
15
  #
16
16
  # Doc on how this fits in the compiling process:
17
- # /doc/modules/ROOT/pages/node_pattern.md
17
+ # /docs/modules/ROOT/pages/node_pattern.adoc
18
18
  class Lexer < LexerRex
19
19
  Error = ScanError
20
20
 
@@ -9,7 +9,7 @@ module RuboCop
9
9
  # Note: class reopened in `parser.racc`
10
10
  #
11
11
  # Doc on how this fits in the compiling process:
12
- # /doc/modules/ROOT/pages/node_pattern.md
12
+ # /docs/modules/ROOT/pages/node_pattern.adoc
13
13
  class Parser < Racc::Parser
14
14
  extend Forwardable
15
15
 
@@ -20,6 +20,9 @@ module RuboCop
20
20
  new(file, ruby_version, path)
21
21
  end
22
22
 
23
+ INVALID_LEVELS = %i[error fatal].freeze
24
+ private_constant :INVALID_LEVELS
25
+
23
26
  def initialize(source, ruby_version, path = nil)
24
27
  # Defaults source encoding to UTF-8, regardless of the encoding it has
25
28
  # been read with, which could be non-utf8 depending on the default
@@ -64,7 +67,7 @@ module RuboCop
64
67
  def valid_syntax?
65
68
  return false if @parser_error
66
69
 
67
- @diagnostics.none? { |d| %i[error fatal].include?(d.level) }
70
+ @diagnostics.none? { |d| INVALID_LEVELS.include?(d.level) }
68
71
  end
69
72
 
70
73
  # Raw source checksum for tracking infinite loops.
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module AST
5
5
  module Version
6
- STRING = '0.8.0'
6
+ STRING = '1.0.1'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-10-12 00:00:00.000000000 Z
13
+ date: 2020-10-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parser
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []
168
- rubygems_version: 3.1.2
168
+ rubygems_version: 3.1.4
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: RuboCop tools to deal with Ruby code AST.