repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/complex_node_spec.rb | spec/rubocop/ast/complex_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::ComplexNode do
subject(:complex_node) { parse_source(source).ast }
describe '.new' do
let(:source) { '+4.2i' }
it { is_expected.to be_a(described_class) }
end
describe '#sign?' do
subject { complex_node.sign? }
context 'when explici... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/super_node_spec.rb | spec/rubocop/ast/super_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::SuperNode do
subject(:super_node) { ast }
let(:ast) { parse_source(source).ast }
describe '.new' do
context 'with a super node' do
let(:source) { 'super(:baz)' }
it { is_expected.to be_a(described_class) }
end
context 'with a ... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/or_node_spec.rb | spec/rubocop/ast/or_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::OrNode do
subject(:or_node) { parse_source(source).ast }
describe '.new' do
context 'with a logical or node' do
let(:source) do
':foo || :bar'
end
it { is_expected.to be_a(described_class) }
end
context 'with a sema... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/keyword_splat_node_spec.rb | spec/rubocop/ast/keyword_splat_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::KeywordSplatNode do
let(:kwsplat_node) { parse_source(source).ast.children.last }
let(:source) { '{ a: 1, **foo }' }
describe '.new' do
it { expect(kwsplat_node).to be_a(described_class) }
end
describe '#hash_rocket?' do
it { expect(kwsplat... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/int_node_spec.rb | spec/rubocop/ast/int_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::IntNode do
subject(:int_node) { parse_source(source).ast }
describe '.new' do
let(:source) { '42' }
it { is_expected.to be_a(described_class) }
end
describe '#sign?' do
subject { int_node.sign? }
context 'explicit positive int' do
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/pair_node_spec.rb | spec/rubocop/ast/pair_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::PairNode do
let(:pair_node) { parse_source(source).ast.children.first }
describe '.new' do
let(:source) { '{ a: 1 }' }
it { expect(pair_node).to be_a(described_class) }
end
describe '#hash_rocket?' do
context 'when using a hash rocket de... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/lambda_node_spec.rb | spec/rubocop/ast/lambda_node_spec.rb | # frozen_string_literal: true
# NOTE: specs for `lambda?` and `lambda_literal?` in `send_node_spec`
RSpec.describe RuboCop::AST::LambdaNode do
subject(:lambda_node) { parse_source(source).ast }
let(:source) { '->(a, b) { a + b }' }
describe '#receiver' do
it { expect(lambda_node.receiver).to be_nil }
end... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/return_node_spec.rb | spec/rubocop/ast/return_node_spec.rb | # frozen_string_literal: true
require_relative 'wrapped_arguments_node'
RSpec.describe RuboCop::AST::ReturnNode do
it_behaves_like 'wrapped arguments node', 'return'
end
| ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/op_asgn_node_spec.rb | spec/rubocop/ast/op_asgn_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::OpAsgnNode do
let(:parsed_source) { parse_source(source) }
let(:op_asgn_node) { parsed_source.ast }
describe '.new' do
context 'with an `op_asgn_node` node' do
let(:source) { 'var += value' }
it { expect(op_asgn_node).to be_a(described_... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/resbody_node_spec.rb | spec/rubocop/ast/resbody_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::ResbodyNode do
let(:resbody_node) do
begin_node = parse_source(source).ast
rescue_node, = *begin_node
rescue_node.children[1]
end
describe '.new' do
let(:source) { 'begin; beginbody; rescue; rescuebody; end' }
it { expect(resbody_no... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/node_pattern_spec.rb | spec/rubocop/ast/node_pattern_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::NodePattern do
include RuboCop::AST::Sexp
def parse(code)
RuboCop::AST::ProcessedSource.new(code, ruby_version, '(string)').ast
end
let(:ruby_version) { 3.3 }
let(:root_node) { parse(ruby) }
let(:node) { root_node }
let(:params) { [] }
le... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | true |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/case_match_node_spec.rb | spec/rubocop/ast/case_match_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::CaseMatchNode do
subject(:case_match_node) { parse_source(source).ast }
context 'when using Ruby 2.7 or newer', :ruby27 do
describe '.new' do
let(:source) do
<<~RUBY
case expr
in pattern
end
RUBY
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/symbol_node_spec.rb | spec/rubocop/ast/symbol_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::SymbolNode do
subject(:sym_node) { parse_source(source).ast }
describe '.new' do
context 'with a symbol node' do
let(:source) do
':foo'
end
it { is_expected.to be_a(described_class) }
end
end
describe '#value' do
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/asgn_node_spec.rb | spec/rubocop/ast/asgn_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::AsgnNode do
let(:asgn_node) { parse_source(source).ast }
describe '.new' do
context 'with a `lvasgn` node' do
let(:source) { 'var = value' }
it { expect(asgn_node).to be_a(described_class) }
end
context 'with a `ivasgn` node' do
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/const_node_spec.rb | spec/rubocop/ast/const_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::ConstNode do
subject(:ast) { parse_source(source).ast }
let(:const_node) { ast }
let(:source) { '::Foo::Bar::BAZ' }
describe '#namespace' do
it { expect(const_node.namespace.source).to eq '::Foo::Bar' }
end
describe '#short_name' do
it {... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/ensure_node_spec.rb | spec/rubocop/ast/ensure_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::EnsureNode do
let(:parsed_source) { parse_source(source) }
let(:ensure_node) { parsed_source.ast.children.first }
let(:node) { parsed_source.node }
describe '.new' do
let(:source) { 'begin; beginbody; ensure; ensurebody; end' }
it { expect(en... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/regexp_node_spec.rb | spec/rubocop/ast/regexp_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::RegexpNode do
subject(:regexp_node) { parse_source(source).ast }
describe '.new' do
let(:source) { '/re/' }
it { is_expected.to be_a(described_class) }
end
describe '#to_regexp' do
# rubocop:disable Security/Eval
context 'with an emp... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/array_node_spec.rb | spec/rubocop/ast/array_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::ArrayNode do
subject(:array_node) { parse_source(source).ast }
describe '.new' do
let(:source) { '[]' }
it { is_expected.to be_a(described_class) }
end
describe '#values' do
context 'with an empty array' do
let(:source) { '[]' }
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/var_node_spec.rb | spec/rubocop/ast/var_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::VarNode do
let(:node) { parse_source(source).node }
describe '.new' do
context 'with a `lvar` node' do
let(:source) { 'x = 1; >>x<<' }
it { expect(node).to be_a(described_class) }
end
context 'with an `ivar` node' do
let(:s... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/break_node_spec.rb | spec/rubocop/ast/break_node_spec.rb | # frozen_string_literal: true
require_relative 'wrapped_arguments_node'
RSpec.describe RuboCop::AST::BreakNode do
it_behaves_like 'wrapped arguments node', 'break'
end
| ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/casgn_node_spec.rb | spec/rubocop/ast/casgn_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::CasgnNode do
let(:casgn_node) { parse_source(source).ast }
describe '.new' do
context 'with a `casgn` node' do
let(:source) { 'VAR = value' }
it { expect(casgn_node).to be_a(described_class) }
end
end
describe '#namespace' do
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/next_node_spec.rb | spec/rubocop/ast/next_node_spec.rb | # frozen_string_literal: true
require_relative 'wrapped_arguments_node'
RSpec.describe RuboCop::AST::NextNode do
it_behaves_like 'wrapped arguments node', 'next'
end
| ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/forward_args_node_spec.rb | spec/rubocop/ast/forward_args_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::ForwardArgsNode do
let(:args_node) { parse_source(source).ast.arguments }
let(:source) { 'def foo(...); end' }
context 'when using Ruby 2.7 or newer', :ruby27 do
if RuboCop::AST::Builder.emit_forward_arg
describe '#to_a' do
it { expect... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/processed_source_spec.rb | spec/rubocop/ast/processed_source_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::ProcessedSource do
subject(:processed_source) do
described_class.new(
source, ruby_version, path, parser_engine: parser_engine, prism_result: prism_result
)
end
let(:source) { <<~RUBY }
# an awesome method
def some_method
put... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/module_node_spec.rb | spec/rubocop/ast/module_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::ModuleNode do
subject(:module_node) { parse_source(source).ast }
describe '.new' do
let(:source) do
'module Foo; end'
end
it { is_expected.to be_a(described_class) }
end
describe '#identifier' do
let(:source) do
'module F... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/and_node_spec.rb | spec/rubocop/ast/and_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::AndNode do
subject(:and_node) { parse_source(source).ast }
describe '.new' do
context 'with a logical and node' do
let(:source) do
':foo && :bar'
end
it { is_expected.to be_a(described_class) }
end
context 'with a s... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/defined_node_spec.rb | spec/rubocop/ast/defined_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::DefinedNode do
subject(:defined_node) { parse_source(source).ast }
describe '.new' do
context 'with a defined? node' do
let(:source) { 'defined? :foo' }
it { is_expected.to be_a(described_class) }
end
end
describe '#receiver' do
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/class_node_spec.rb | spec/rubocop/ast/class_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::ClassNode do
subject(:class_node) { parse_source(source).ast }
describe '.new' do
let(:source) do
'class Foo; end'
end
it { is_expected.to be_a(described_class) }
end
describe '#identifier' do
let(:source) do
'class Foo; ... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/procarg0_node_spec.rb | spec/rubocop/ast/procarg0_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::Procarg0Node, :ruby27 do
let(:procarg0_node) { parse_source(source).ast.first_argument }
describe '.new' do
context 'with a block' do
let(:source) { 'foo { |x| x }' }
if RuboCop::AST::Builder.emit_procarg0
it { expect(procarg0_nod... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/block_node_spec.rb | spec/rubocop/ast/block_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::BlockNode do
subject(:block_node) { parse_source(source).ast }
describe '.new' do
let(:source) { 'foo { |q| bar(q) }' }
it { is_expected.to be_a(described_class) }
end
describe '#arguments' do
context 'with no arguments' do
let(:so... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/traversal_spec.rb | spec/rubocop/ast/traversal_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::Traversal do
subject(:traverse) do
instance.walk(node)
instance
end
let(:ast) { parse_source(source).ast }
let(:instance) { klass.new }
let(:node) { ast }
context 'when a class defines on_arg', :ruby30 do
let(:klass) do
Class.ne... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/case_node_spec.rb | spec/rubocop/ast/case_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::CaseNode do
subject(:ast) { parse_source(source).ast }
let(:case_node) { ast }
describe '.new' do
let(:source) do
['case',
'when :foo then bar',
'end'].join("\n")
end
it { expect(case_node).to be_a(described_class) }
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/float_node_spec.rb | spec/rubocop/ast/float_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::FloatNode do
subject(:float_node) { parse_source(source).ast }
describe '.new' do
let(:source) { '42.0' }
it { is_expected.to be_a(described_class) }
end
describe '#sign?' do
subject { float_node.sign? }
context 'explicit positive f... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/yield_node_spec.rb | spec/rubocop/ast/yield_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::YieldNode do
subject(:yield_node) { ast }
let(:ast) { parse_source(source).ast }
describe '.new' do
let(:source) { 'yield :foo, :bar' }
it { is_expected.to be_a(described_class) }
end
describe '#receiver' do
let(:source) { 'yield :foo... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/send_node_spec.rb | spec/rubocop/ast/send_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::SendNode do
let(:send_node) { parse_source(source).node }
describe '.new' do
context 'with a regular method send' do
let(:source) { 'foo.bar(:baz)' }
it { expect(send_node).to be_a(described_class) }
end
context 'with a safe navi... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | true |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/rubocop_compatibility_spec.rb | spec/rubocop/ast/rubocop_compatibility_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::RuboCopCompatibility do
subject(:callback) { RuboCop::AST.rubocop_loaded }
before do
stub_const '::RuboCop::Version::STRING', rubocop_version
end
context 'when ran from an incompatible version of Rubocop' do
let(:rubocop_version) { '0.42.0' }... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/dstr_node_spec.rb | spec/rubocop/ast/dstr_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::DstrNode do
subject(:dstr_node) { parse_source(source).ast }
describe '#value' do
subject { dstr_node.value }
context 'with a multiline string' do
let(:source) do
<<~RUBY
'this is a multiline ' \
'string'
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/hash_node_spec.rb | spec/rubocop/ast/hash_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::HashNode do
subject(:hash_node) { parse_source(source).ast }
describe '.new' do
let(:source) { '{}' }
it { is_expected.to be_a(described_class) }
end
describe '#pairs' do
context 'with an empty hash' do
let(:source) { '{}' }
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/mlhs_node_spec.rb | spec/rubocop/ast/mlhs_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::MlhsNode do
let(:mlhs_node) { parse_source(source).ast.node_parts[0] }
describe '.new' do
context 'with a `masgn` node' do
let(:source) { 'x, y = z' }
it { expect(mlhs_node).to be_a(described_class) }
end
end
describe '#assignmen... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/args_node_spec.rb | spec/rubocop/ast/args_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::ArgsNode do
let(:args_node) { parse_source(source).ast.arguments }
describe '.new' do
context 'with a method definition' do
let(:source) { 'def foo(x) end' }
it { expect(args_node).to be_a(described_class) }
end
context 'with a b... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/while_node_spec.rb | spec/rubocop/ast/while_node_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::WhileNode do
subject(:while_node) { parse_source(source).ast }
describe '.new' do
context 'with a statement while' do
let(:source) { 'while foo; bar; end' }
it { is_expected.to be_a(described_class) }
end
context 'with a modifier... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/node_spec.rb | spec/rubocop/ast/node_spec.rb | # frozen_string_literal: true
require 'uri'
module RuboCop
module AST
# Patch Node
class Node
# Let's make our predicate matchers read better
def used?
value_used?
end
end
end
end
RSpec.describe RuboCop::AST::Node do
let(:ast) { parse_source(src).node }
let(:node) { ast ... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/fixtures/code_examples.rb | spec/rubocop/ast/fixtures/code_examples.rb | # Extracted from `parser` gem.
# Add the following code at the beginning of `def assert_parses`:
#
# File.open('./out.rb', 'a+') do |f|
# f << code << "\n\n#----\n" if versions.include? '2.7'
# end
alias $a $b
#----
alias $a $+
#----
bar unless foo
#----
foo[1, 2]
#----
Foo = 10
#----
!foo
#----
case ... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/node_pattern/parse_helper.rb | spec/rubocop/ast/node_pattern/parse_helper.rb | # frozen_string_literal: true
# Copied from Parser, some lines commented out with `# !!!`
module ParseHelper
include AST::Sexp
# !!! require 'parser/all'
# !!! require 'parser/macruby'
# !!! require 'parser/rubymotion'
ALL_VERSIONS = %w(1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 mac ios)
def setup
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/node_pattern/helper.rb | spec/rubocop/ast/node_pattern/helper.rb | # frozen_string_literal: true
require_relative 'parse_helper'
Failure = Struct.new(:expected, :actual)
module NodePatternHelper
include ParseHelper
def assert_equal(expected, actual, mess = nil)
expect(actual).to eq(expected), *mess
end
def assert(test, mess = nil)
expect(test).to be(true), *mess
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/node_pattern/parser_spec.rb | spec/rubocop/ast/node_pattern/parser_spec.rb | # frozen_string_literal: true
require_relative 'helper'
RSpec.describe RuboCop::AST::NodePattern::Parser do
include_context 'parser'
describe 'sequences' do
it 'parses simple sequences properly' do
expect_parsing(
s(:sequence, s(:node_type, :int), s(:number, 42)),
'(int 42)',
'^... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/node_pattern/lexer_spec.rb | spec/rubocop/ast/node_pattern/lexer_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::NodePattern::Lexer do
let(:source) { '(send nil? #func(:foo) #func (bar))' }
let(:lexer) { RuboCop::AST::NodePattern::Parser::WithMeta::Lexer.new(source) }
let(:tokens) do
tokens = []
while (token = lexer.next_token)
tokens << token
end... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/node_pattern/sets_spec.rb | spec/rubocop/ast/node_pattern/sets_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::NodePattern::Sets do
subject(:name) { described_class[set] }
let(:set) { Set[1, 2, 3, 4, 5, 6] }
it { is_expected.to eq '::RuboCop::AST::NodePattern::Sets::SET_1_2_3_ETC' }
it { is_expected.to eq described_class[Set[6, 5, 4, 3, 2, 1]] }
it { is_e... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/ext/range_spec.rb | spec/rubocop/ast/ext/range_spec.rb | # frozen_string_literal: true
RSpec.describe RuboCop::AST::Ext::Range do
subject(:node) { parse_source(source).ast }
let(:source) { <<~RUBY }
[
1,
2
]
RUBY
describe '#line_span' do
it 'returns the range of lines a range occupies' do
expect(node.loc.begin.line_span).to eq 1..1
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/spec/rubocop/ast/ext/set_spec.rb | spec/rubocop/ast/ext/set_spec.rb | # frozen_string_literal: true
# rubocop:disable RSpec/DescribeClass, Style/CaseEquality
RSpec.describe 'Set#===' do
it 'tests for inclusion' do
expect(Set[1, 2, 3] === 2).to be true
end
end
# rubocop:enable RSpec/DescribeClass, Style/CaseEquality
| ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop-ast.rb | lib/rubocop-ast.rb | # frozen_string_literal: true
require_relative 'rubocop/ast'
| ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast.rb | lib/rubocop/ast.rb | # frozen_string_literal: true
require 'parser'
require 'prism'
require 'forwardable'
require 'set'
require_relative 'ast/ext/range'
require_relative 'ast/utilities/simple_forwardable'
require_relative 'ast/node_pattern/method_definer'
require_relative 'ast/node_pattern'
require_relative 'ast/node/mixin/descendence'
r... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/version.rb | lib/rubocop/ast/version.rb | # frozen_string_literal: true
module RuboCop
module AST
module Version
STRING = '1.49.0'
end
end
end
| ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/sexp.rb | lib/rubocop/ast/sexp.rb | # frozen_string_literal: true
module RuboCop
module AST
# This module provides a shorthand method to create a {Node} like
# `Parser::AST::Sexp`.
#
# @see https://www.rubydoc.info/gems/ast/AST/Sexp
module Sexp
# Creates a {Node} with type `type` and children `children`.
def s(type, *ch... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/processed_source.rb | lib/rubocop/ast/processed_source.rb | # frozen_string_literal: true
require 'digest/sha1'
module RuboCop
module AST
# A `Prism` interface's class that provides a fixed `Prism::ParseLexResult` instead of parsing.
#
# This class implements the `parse_lex` method to return a preparsed `Prism::ParseLexResult`
# rather than parsing the sourc... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node.rb | lib/rubocop/ast/node.rb | # frozen_string_literal: true
module RuboCop
module AST
# `RuboCop::AST::Node` is a subclass of `Parser::AST::Node`. It provides
# access to parent nodes and an object-oriented way to traverse an AST with
# the power of `Enumerable`.
#
# It has predicate methods for every node type, like this:
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node_pattern.rb | lib/rubocop/ast/node_pattern.rb | # frozen_string_literal: true
require 'delegate'
module RuboCop
module AST
# This class performs a pattern-matching operation on an AST node.
#
# Detailed syntax: /docs/modules/ROOT/pages/node_pattern.adoc
#
# Initialize a new `NodePattern` with `NodePattern.new(pattern_string)`, then
# pass... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/rubocop_compatibility.rb | lib/rubocop/ast/rubocop_compatibility.rb | # frozen_string_literal: true
module RuboCop
# ...
module AST
# Responsible for compatibility with main gem
# @api private
module RuboCopCompatibility
INCOMPATIBLE_COPS = {
'0.89.0' => 'Layout/LineLength',
'0.92.0' => 'Style/MixinUsage'
}.freeze
def rubocop_loaded
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/token.rb | lib/rubocop/ast/token.rb | # frozen_string_literal: true
module RuboCop
module AST
# A basic wrapper around Parser's tokens.
class Token
LEFT_PAREN_TYPES = %i[tLPAREN tLPAREN2].freeze
LEFT_CURLY_TYPES = %i[tLCURLY tLAMBEG].freeze
attr_reader :pos, :type, :text
def self.from_parser_token(parser_token)
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/builder.rb | lib/rubocop/ast/builder.rb | # frozen_string_literal: true
module RuboCop
module AST
# Common functionality between the parser and prism builder
# @api private
module BuilderExtensions
def self.included(base)
base.emit_forward_arg = true
base.emit_match_pattern = true
end
# @api private
NODE_... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/traversal.rb | lib/rubocop/ast/traversal.rb | # frozen_string_literal: true
module RuboCop
module AST
# Provides methods for traversing an AST.
# Does not transform an AST; for that, use Parser::AST::Processor.
# Override methods to perform custom processing. Remember to call `super`
# if you want to recursively process descendant nodes.
mod... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/builder_prism.rb | lib/rubocop/ast/builder_prism.rb | # frozen_string_literal: true
module RuboCop
module AST
# A parser builder, based on the one provided by prism,
# which is capable of emitting AST for more recent Rubies.
class BuilderPrism < Prism::Translation::Parser::Builder
include BuilderExtensions
end
end
end
| ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/masgn_node.rb | lib/rubocop/ast/node/masgn_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `masgn` nodes.
# This will be used in place of a plain node when the builder constructs
# the AST, making its methods available to all assignment nodes within RuboCop.
class MasgnNode < Node
# @return [MlhsNode] the ... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/regexp_node.rb | lib/rubocop/ast/node/regexp_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `regexp` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `regexp` nodes within RuboCop.
class RegexpNode < Node
OPTIONS = {
x: Re... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/next_node.rb | lib/rubocop/ast/node/next_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `next` nodes. This will be used in place of a
# plain node when the builder constructs the AST, making its methods
# available to all `next` nodes within RuboCop.
class NextNode < Node
include ParameterizedNode::Wrap... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/or_node.rb | lib/rubocop/ast/node/or_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `or` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `or` nodes within RuboCop.
class OrNode < Node
include BinaryOperatorNode
incl... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/for_node.rb | lib/rubocop/ast/node/for_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `for` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `for` nodes within RuboCop.
class ForNode < Node
# Returns the keyword of the `for`... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/int_node.rb | lib/rubocop/ast/node/int_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `int` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available to
# all `int` nodes within RuboCop.
class IntNode < Node
include BasicLiteralNode
inc... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/when_node.rb | lib/rubocop/ast/node/when_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `when` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `when` nodes within RuboCop.
class WhenNode < Node
# Returns an array of all the c... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/op_asgn_node.rb | lib/rubocop/ast/node/op_asgn_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `op_asgn` nodes.
# This will be used in place of a plain node when the builder constructs
# the AST, making its methods available to all assignment nodes within RuboCop.
class OpAsgnNode < Node
# @return [AsgnNode] t... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/while_node.rb | lib/rubocop/ast/node/while_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `while` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `while` nodes within RuboCop.
class WhileNode < Node
include ConditionalNode
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/resbody_node.rb | lib/rubocop/ast/node/resbody_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `resbody` nodes. This will be used in place of a
# plain node when the builder constructs the AST, making its methods
# available to all `resbody` nodes within RuboCop.
class ResbodyNode < Node
# Returns the body of ... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/block_node.rb | lib/rubocop/ast/node/block_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `block` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `send` nodes within RuboCop.
#
# A `block` node is essentially a method send with a... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/hash_node.rb | lib/rubocop/ast/node/hash_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `hash` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `hash` nodes within RuboCop.
class HashNode < Node
# Returns an array of all the k... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/alias_node.rb | lib/rubocop/ast/node/alias_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `alias` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `alias` nodes within RuboCop.
class AliasNode < Node
# Returns the old identifier... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/if_node.rb | lib/rubocop/ast/node/if_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `if` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `if` nodes within RuboCop.
class IfNode < Node
include ConditionalNode
include... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/indexasgn_node.rb | lib/rubocop/ast/node/indexasgn_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# Used for modern support only!
# Not as thoroughly tested as legacy equivalent
#
# $ ruby-parse -e "foo[:bar] = :baz"
# (indexasgn
# (send nil :foo)
# (sym :bar)
# (sym :baz))
# $ ruby-parse --legacy -e "fo... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/class_node.rb | lib/rubocop/ast/node/class_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `class` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `class` nodes within RuboCop.
class ClassNode < Node
# The identifier for this `c... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/float_node.rb | lib/rubocop/ast/node/float_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `float` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available to
# all `float` nodes within RuboCop.
class FloatNode < Node
include BasicLiteralNode
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/in_pattern_node.rb | lib/rubocop/ast/node/in_pattern_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `in` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `in` nodes within RuboCop.
class InPatternNode < Node
# Returns a node of the patter... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/rescue_node.rb | lib/rubocop/ast/node/rescue_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `rescue` nodes. This will be used in place of a
# plain node when the builder constructs the AST, making its methods
# available to all `rescue` nodes within RuboCop.
class RescueNode < Node
# Returns the body of the... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/ensure_node.rb | lib/rubocop/ast/node/ensure_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `ensure` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `ensure` nodes within RuboCop.
class EnsureNode < Node
DEPRECATION_WARNING_LOCAT... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/lambda_node.rb | lib/rubocop/ast/node/lambda_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# Used for modern support only:
# Not as thoroughly tested as legacy equivalent
#
# $ ruby-parse -e "->(foo) { bar }"
# (block
# (lambda)
# (args
# (arg :foo))
# (send nil :bar))
# $ ruby-parse --l... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/case_match_node.rb | lib/rubocop/ast/node/case_match_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `case_match` nodes. This will be used in place of
# a plain node when the builder constructs the AST, making its methods
# available to all `case_match` nodes within RuboCop.
class CaseMatchNode < Node
include Condit... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/send_node.rb | lib/rubocop/ast/node/send_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `send` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `send` nodes within RuboCop.
class SendNode < Node
include ParameterizedNode::Rest... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/range_node.rb | lib/rubocop/ast/node/range_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `irange` and `erange` nodes. This will be used in
# place of a plain node when the builder constructs the AST, making its
# methods available to all `irange` and `erange` nodes within RuboCop.
class RangeNode < Node
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/rational_node.rb | lib/rubocop/ast/node/rational_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `rational` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available to
# all `rational` nodes within RuboCop.
class RationalNode < Node
include BasicLitera... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/complex_node.rb | lib/rubocop/ast/node/complex_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `complex` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available to
# all `complex` nodes within RuboCop.
class ComplexNode < Node
include BasicLiteralNo... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/or_asgn_node.rb | lib/rubocop/ast/node/or_asgn_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `op_asgn` nodes.
# This will be used in place of a plain node when the builder constructs
# the AST, making its methods available to all assignment nodes within RuboCop.
class OrAsgnNode < OpAsgnNode
# The operator b... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/symbol_node.rb | lib/rubocop/ast/node/symbol_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `sym` nodes. This will be used in place of a
# plain node when the builder constructs the AST, making its methods
# available to all `sym` nodes within RuboCop.
class SymbolNode < Node
include BasicLiteralNode
e... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/array_node.rb | lib/rubocop/ast/node/array_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `array` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `array` nodes within RuboCop.
class ArrayNode < Node
PERCENT_LITERAL_TYPES = {
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/mlhs_node.rb | lib/rubocop/ast/node/mlhs_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `mlhs` nodes.
# This will be used in place of a plain node when the builder constructs
# the AST, making its methods available to all assignment nodes within RuboCop.
class MlhsNode < Node
# Returns all the assignmen... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/defined_node.rb | lib/rubocop/ast/node/defined_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `defined?` nodes. This will be used in place of a
# plain node when the builder constructs the AST, making its methods
# available to all `send` nodes within RuboCop.
class DefinedNode < Node
include ParameterizedNod... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/pair_node.rb | lib/rubocop/ast/node/pair_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `pair` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `pair` nodes within RuboCop.
class PairNode < Node
include HashElementNode
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/yield_node.rb | lib/rubocop/ast/node/yield_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `yield` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `yield` nodes within RuboCop.
class YieldNode < Node
include ParameterizedNode
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/asgn_node.rb | lib/rubocop/ast/node/asgn_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `lvasgn`, `ivasgn`, `cvasgn`, and `gvasgn` nodes.
# This will be used in place of a plain node when the builder constructs
# the AST, making its methods available to all assignment nodes within RuboCop.
class AsgnNode < No... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/def_node.rb | lib/rubocop/ast/node/def_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `def` nodes. This will be used in place of a plain
# node when the builder constructs the AST, making its methods available
# to all `def` nodes within RuboCop.
class DefNode < Node
include ParameterizedNode
in... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/module_node.rb | lib/rubocop/ast/node/module_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `module` nodes. This will be used in place of a
# plain node when the builder constructs the AST, making its methods
# available to all `module` nodes within RuboCop.
class ModuleNode < Node
# The identifier for this... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/return_node.rb | lib/rubocop/ast/node/return_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `return` nodes. This will be used in place of a
# plain node when the builder constructs the AST, making its methods
# available to all `return` nodes within RuboCop.
class ReturnNode < Node
include ParameterizedNode... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
rubocop/rubocop-ast | https://github.com/rubocop/rubocop-ast/blob/69036498c11ca944c6099d1b672ba408f34a3eb4/lib/rubocop/ast/node/forward_args_node.rb | lib/rubocop/ast/node/forward_args_node.rb | # frozen_string_literal: true
module RuboCop
module AST
# A node extension for `forward-args` nodes. This will be used in place
# of a plain node when the builder constructs the AST, making its methods
# available to all `forward-args` nodes within RuboCop.
#
# Not used with modern emitters:
... | ruby | MIT | 69036498c11ca944c6099d1b672ba408f34a3eb4 | 2026-01-04T17:49:41.556809Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.