123456789_123456789_123456789_123456789_123456789_

Change log

master (unreleased)

1.50.0 (2026-07-04)

Bug fixes

*#412: Fix Node#argument? returning true for receivers that are structurally equal to an argument (e.g. the receiver in foo.bar(foo)). (@bbatsov) *#401: Avoid intermediate array allocations in HashNode#each_key/each_value. (@bbatsov) *#409: Fix Node#chained? and MethodDispatchNode#block_literal? returning true for nodes that are merely structurally equal to the receiver or send node (e.g. the argument in foo.bar(foo)). (@bbatsov) *#407: Fix the blockless form of the deprecated each_when, each_in_pattern, each_condition, and each_branch methods, which returned an unusable Enumerator. (@bbatsov) *#401: Fix force_encoding being a no-op for frozen string inputs. (@bbatsov) *#408: Fix ProcessedSource#preceding_line returning the last line of the file for tokens on the first line. (@bbatsov)

Changes

*#411: Speed up filtered node traversals (each_descendant(:send) etc.) by not allocating an array per visited node, and add the non-splatting Node#type_in? predicate. (@bbatsov) *#404: Improve parser_prism performance by building tokens only when they are first accessed. (@bbatsov) *#408: Memoize ProcessedSource#checksum and skip the token sort when the tokens are already in order. (@bbatsov) *#410: Reduce allocations in keyword? and the method-name predicates (predicate_method?, bang_method?, etc.). (@bbatsov) *#405: Use Prism by default when analyzing Ruby 3.3 code. (@bbatsov)

1.49.1 (2026-03-11)

Bug fixes

-#399: Fix unification variables not persisting in any-order nodes. (@marcandre)

1.49.0 (2025-12-28)

New features

-#394: Support Ruby 4.1 (experimental). (@koic)

1.48.0 (2025-11-08)

New features

-#391: Support Ruby 4.0 (experimental). (@koic)

1.47.1 (2025-09-21)

Bug fixes

*#386: Fix parsing of node patterns that match against the empty string. (@earloapin)

1.47.0 (2025-09-19)

New features

*#387: Add Node#any_sym_type? to match sym and dsym types. (@dvandersluis) *#328: Add Node#any_str_type? to match str, dstr, and xstr types. (@dvandersluis)

1.46.0 (2025-07-16)

New features

*#379: Support ::RuboCop::AST::ComplexNode. (@koic)

Bug fixes

*#380: Fix RuboCop::AST::NumericNode#sign? to return boolean. (@viralpraxis)

1.45.1 (2025-06-08)

Bug fixes

*#382: Fix an error when using Parser gem with prism_result. (@koic)

1.45.0 (2025-06-03)

New features

*#381: Support AST::Node#any_match_pattern_type? method. (@koic)

1.44.1 (2025-04-11)

Bug fixes

*#378: Fix flip-flop operator possible children nodes count. (@viralpraxis)

1.44.0 (2025-04-03)

New features

*#377: Support RuboCop::AST::Node#any_def_type? method. (@koic)

1.43.0 (2025-03-25)

Changes

*#374: Use the prism translation layer to analyze Ruby 3.4 by default. (@earlopain) *#373: Add prism as a runtime dependency. (@earlopain)

1.42.0 (2025-03-25)

New features

*#370: Support Prism::Translation::Parser35 for Ruby 3.5 parser (experimental). (@earlopain, @koic)

1.41.0 (2025-03-21)

New features

*#365: Add support for itblock node for Ruby 3.4. (@earlopain)

1.40.0 (2025-03-19)

Changes

*#354: Use Prism::Translation::Parser::Builder when parsing with prism. (@earlopain)

1.39.0 (2025-03-16)

New features

*#359: Enable reusable Prism parse result. (@koic)

1.38.1 (2025-02-25)

Bug fixes

*#360: Fix an error when the Array core class contains a writer method before rubocop-ast loaded. (@earlopain)

1.38.0 (2025-01-27)

New features

*#346: Add Node#loc? to determine if a node has a given location. (@dvandersluis) *#356: Added :any_block as an alias for :block and :numblock, use it with Node#any_block_type?. Also available in node patterns: {block numblock} can become any_block. (@earlopain)

Bug fixes

*#323: Fix node captures inside of ?, +, and * repetition. (@earlopain)

Changes

*#357: Support node groups in Node#each_descendant and similar traversal methods. (@earlopain)

1.37.0 (2024-12-13)

New features

*#341: Make ::RuboCop::AST::IfNode support then?. (@koic) *#345: Add Node#loc_is? for easier test of locations. (@marcandre)

Changes

*#343: Add StrNode#single_quoted?, StrNode#double_quoted? and StrNode#percent_literal? to simplify checking for string delimiters. (@dvandersluis)

1.36.2 (2024-11-27)

Bug fixes

*#340: Handle anonymous splats in MlhsNode. (@earlopain)

1.36.1 (2024-11-13)

Bug fixes

*#339: Do not emit a deprecation warning for EnsureNode#body to give RuboCop a chance to update its usage. EnsureNode#body will still be changed in the next major version of rubocop-ast. (@earlopain)

1.36.0 (2024-11-13)

Changes

*#337: Deprecate EnsureNode#body in favour of EnsureNode#branch. EnsureNode#body will be redefined in the next major version of rubocop-ast. (@dvandersluis)

1.35.0 (2024-11-11)

New features

*#333: Add BeginNode for kwbegin nodes. (@dvandersluis)

Changes

*#333: Add EnsureNode#rescue_node method. (@dvandersluis)

1.34.1 (2024-11-07)

New features

*#329: Add Node#type? to reduce complexity of checking against multiple node types. (@dvandersluis) *#330: Extend Node#const_name to casgn nodes. (@dvandersluis)

Bug fixes

*#331: [Fix #331] Fix crash in OpAsgnNode#name when the lhs is a send or csend node. (@dvandersluis)

1.34.0 (2024-11-04)

New features

-#326: Introduce lhs and rhs aliases to assignment nodes for consistency. (@dvandersluis)

1.33.1 (2024-11-02)

Bug fixes

-#325: Allow non_bare_access_modifier_declaration? to handle modifiers with multiple arguments. (@dvandersluis)

1.33.0 (2024-10-29)

New features

-#203: Add classes for masgn and mlhs nodes. (@dvandersluis) -#204: Add VarNode class for lvar, ivar, cvar and gvar node types. (@dvandersluis)

1.32.3 (2024-09-05)

Bug fixes

-#310: Fix RuboCop::AST::DefNode#void_context? to handle class methods called initialize. (@vlad-pisanov)

1.32.2 (2024-09-02)

1.32.1 (2024-08-17)

Changes

-#309: Mark ::RuboCop::AST::EnsureNode as being in a void context. (@earlopain)

1.32.0 (2024-08-05)

New features

-#304: Add ::RuboCop::AST::RationalNode. (@koic)

1.31.3 (2024-04-29)

Bug fixes

-#289: Fix an error during parsing when encountering unknown encodings in the encoding magic comment. (@Earlopain)

1.31.2 (2024-03-08)

Bug fixes

-#286: Improve error message for invalid parser_engine value. (@Earlopain)

1.31.1 (2024-03-01)

Changes

-#282: Remove Prism from runtime dependency. (@koic)

1.31.0 (2024-02-29)

New features

-#277: Support Prism as a Ruby parser (experimental). (@koic) -#276: Support Parser::Ruby34 for Ruby 3.4 parser (experimental). (@koic)

Changes

-#279: (Compatibility) Drop Ruby 2.6 runtime support. (@koic) -#272: Make Node#left_curly_brace? aware of lambda brace. (@koic)

1.30.0 (2023-10-26)

New features

-#270: Add BlockNode#{first,last}_argument helpers. (@sambostock)

1.29.0 (2023-06-01)

-#262: Introduce RuboCop::Ast::MethodDispatchNode#selector. (@gsamokovarov)

1.28.1 (2023-05-01)

Bug fixes

-#262: Fix an error when parsing non UTF-8 frozen string. (@koic)

1.28.0 (2023-03-24)

New features

-#259: Add forwarded_kwrestarg node to AST::Builder. (@koic)

1.27.0 (2023-02-27)

New features

-#229: Add source_range method to NodePattern. (@koic)

1.26.0 (2023-02-11)

New features

-#255: Make Node#class_constructor? aware of Ruby 3.2's Data.define. (@koic) -#255: Make Node#class_construcor? aware of Ruby 2.7's numbered parameters. (@koic)

1.25.0 (2023-02-11)

New features

-#256: Support Parser::Ruby33 for Ruby 3.3 parser (experimental). (@koic)

1.24.1 (2022-12-29)

1.24.0 (2022-11-30)

New features

-#245: Add node types forwarded_restarg and forwarded_kwrestarg. (@ydah)

1.23.0 (2022-10-21)

New features

-#242: Add character_literal? to StrNode. (@koic)

1.22.0 (2022-10-17)

New features

-#240: Add a type predicate new_line? to Token. (@tdeo)

1.21.0 (2022-08-08)

New features

-#231: Add a type predicate dot? to Token. (@nobuyo)

1.20.1 (2022-08-07)

New features

-#237 Fix #macro? for numblock nodes (@gsamokovarov)

1.20.0 (2022-08-07)

Bug fixes

-#230: Make RegexpNode aware of fixed-encoding regopt. (@koic)

1.19.1 (2022-07-10)

New features

-#235: Add regexp_dots? method to ::RuboCop::AST::Token (erroneously released in 1.19.0 as regexp_dot?). (@koic)

1.18.0 (2022-05-13)

New features

-#233: Make parse from Ruby 1.9 to 2.3 available. (@koic)

Changes

-#232: (Compatibility) Drop support for Ruby 2.5. (@koic)

1.17.0 (2022-04-09)

New features

-#227: Make Node#condition? aware of case-match node. (@koic)

1.16.0 (2022-02-21)

New features

-#223: Support Parser::Ruby32 for Ruby 3.2 parser (experimental). (@koic)

1.15.2 (2022-02-12)

Bug fixes

1.15.1 (2021-12-27)

Bug fixes

-#10220: Make AST::Node#receiver aware of csend block method calls. (@koic)

1.15.0 (2021-12-12)

New features

-#10219: Add value_omission method to AST::PairNode for Ruby 3.1's hash value omission. (@koic)

1.14.0 (2021-12-02)

New features

-#218: Support Ruby 3.1's anonymous block forwarding syntax. (@koic)

1.13.0 (2021-11-07)

New features

-#213: Make Node#numeric_type? aware of rational and complex literals. (@koic)

1.12.0 (2021-09-27)

Bug fixes

-#208: Update MethodDispatchNode#block_literal? to return true for numblocks. (@dvandersluis)

1.11.0 (2021-08-24)

New features

-#205: Make class, module, and struct definitions aware of numblock. (@koic)

1.10.0 (2021-08-12)

New features

-#201: Add discrete node classes for assignments. (@dvandersluis)

1.9.1 (2021-08-10)

Bug fixes

-#197: [Fix #184] Fix Node#parent_module_name for sclass nodes. (@dvandersluis)

1.9.0 (2021-08-06)

New features

-#195: Move ProcessedSource#sorted_tokens to be a public method. (@dvandersluis)

1.8.0 (2021-07-14)

New features

-#192: Add branches method for AST::CaseMatchNode. (@koic)

Changes

1.7.0 (2021-05-28)

New features

-#171: Add SendNode#def_modifier that returns the def node it modifies, or nil. (@marcandre) -#186: Add pattern method for AST::InPatternNode node. (@koic)

1.6.0 (2021-05-26)

New features

-#183: Add AST::InPatternNode node. (@koic)

1.5.0 (2021-05-02)

New features

-#182: Support Parser::Ruby31 for Ruby 3.1 parser (experimental). (@koic)

1.4.2 (2021-05-02)

Bug fixes

-#179: Have ast_with_comments distinguish nodes with same content. (@marcandre)

1.4.1 (2021-01-23)

Changes

-#167: Fix #value for dstr nodes to return the actual string value. (@dvandersluis)

1.4.0 (2021-01-01)

Changes

-#162: Improve compatibility with parser 3.0. Turn on emit_match_pattern switch. (@marcandre)

1.3.0 (2020-11-30)

Changes

-#156: NodePattern now considers constant names to refer to constants (instead of predicate #Example_type?). (@marcandre)

1.2.0 (2020-11-24)

New features

-#154: Add ArgNode and Procarg0Node ("modern" mode), and add ArgsNode#argument_list to get only argument type nodes. (@dvandersluis)

Changes

-#155: Enable BlockNode#argument_list for numblocks. (@dvandersluis) -#154: Add BlockNode#argument_list and BlockNode#argument_names. (@dvandersluis) -#147: def_node_pattern and def_node_search now return the method name. (@marcandre)

1.1.1 (2020-11-04)

Bug fixes

-#146: Fix IfNode#branches to return both branches when called on ternary conditional. (@fatkodima)

1.1.0 (2020-10-26)

New features

-#144: NodePattern: allow method calls on constants. (@marcandre)

1.0.1 (2020-10-23)

Bug fixes

-#141: Make SendNode#macro? and RuboCop::AST::Node#class_constructor? aware of struct constructor and RuboCop::AST::Node#struct_constructor? is deprecated. (@koic) -#142: Only traverse send nodes in MethodDispatchNode#def_modifier?. (@eugeneius)

1.0.0 (2020-10-21)

Changes

0.8.0 (2020-10-12)

New features

-#49: Add DefNode#endless? (Ruby 3.0). (@marcandre) -#117: Future-proof AST::Traversal by detecting unknown Node types. (@marcandre) -#131: Add rake tasks to merge and create Changelog entries. (@marcandre)

Bug fixes

-#117: All nodes of break and next are now traversed. (@marcandre)

0.7.1 (2020-09-28)

Bug fixes

-#127: Fix dependency issue for JRuby. (@marcandre)

0.7.0 (2020-09-27)

New features

-#105](https://github.com/rubocop/rubocop-ast/pull/105): NodePattern compiler [complete rewrite. Add support for multiple variadic terms. (@marcandre) -#109](https://github.com/rubocop/rubocop-ast/pull/109): Add NodePattern debugging rake tasks: test_pattern, compile, parse. See also [this app (@marcandre) -#110: Add NodePattern support for multiple terms unions. (@marcandre) -#111: Optimize some NodePatterns by using Sets. (@marcandre) -#112: Add NodePattern support for Regexp literals. (@marcandre)

Changes

-#22: (Potentially breaking) Most constants are now private, the rest are converted to Sets and meant to be private. (@marcandre)

0.6.0 (2020-09-26)

New features

-#124: Add RegexpNode#options. (@owst)

0.5.1 (2020-09-25)

Bug fixes

-#120: (Potentially breaking) Fix false positives and negatives for SendNode#macro?. This impacts {non_}bare_access_modifier? and special_access_modifier?. (@marcandre)

0.5.0 (2020-09-24)

New features

-#122: Add Node#parent? and Node#root?. (@marcandre)

Changes

-#121: Update from Parser::Ruby28 to Parser::Ruby30 for Ruby 3.0 parser (experimental). (@koic)

0.4.2 (2020-09-18)

Bug fixes

-#116: Fix issues with tokens being sometimes misordered. (@fatkodima)

0.4.1 (2020-09-16)

Bug fixes

-#115: Fix ConstNode#absolute? when the constant is not namespaced. (@dvandersluis)

0.4.0 (2020-09-11)

New features

-#92: Add ProcessedSource#tokens_within, ProcessedSource#first_token_of and ProcessedSource#last_token_of. (@fatkodima) -#88: Add RescueNode. Add ResbodyNode#exceptions and ResbodyNode#branch_index. (@fatkodima) -#89: Support right hand assignment for Ruby 2.8 (3.0) parser. (@koic) -#93: Add Node#{left|right}_sibling{s} (@marcandre) -#99: Add ConstNode and some helper methods. (@marcandre)

Changes

-#94: In Ruby 2.4, Set#=== is harmonized with Ruby 2.5+ to call include?. (@marcandre) -#91: (Potentially breaking) Node#arguments always returns a frozen array (@marcandre)

0.3.0 (2020-08-01)

New features

-#70: Add NextNode (@marcandre) -#85: Add IntNode#value and FloatNode#value. (@fatkodima) -#82: NodePattern: Allow comments (@marcandre) -#83: Add ProcessedSource#comment_at_line (@marcandre) -#83: Add ProcessedSource#each_comment_in_lines (@marcandre) -#84: Add Source::Range#line_span (@marcandre) -#87: Add CaseNode#branches (@marcandre)

Bug fixes

-#70: Fix arguments processing for BreakNode (@marcandre) -#70: (Potentially breaking) BreakNode and ReturnNode no longer include MethodDispatchNode. These methods were severely broken (@marcandre)

Changes

-#44: (Breaking) Use parser flag self.emit_forward_arg = true by default. (@marcandre) -#86: PairNode#delimiter and inverse_delimiter now accept their argument as a named argument. (@marcandre) -#87: (Potentially breaking) Have IfNode#branches return a nil value if source has else; end (@marcandre) -#72: (Potentially breaking) SuperNode/DefinedNode/YieldNode#arguments now return a frozen array. (@marcandre)

0.2.0 (2020-07-19)

New features

-#50: Support find pattern matching for Ruby 2.8 (3.0) parser. (@koic) -#55: Add ProcessedSource#line_with_comment?. (@marcandre) -#63: NodePattern now supports patterns as arguments to predicate and functions. (@marcandre) -#64: Add Node#global_const?. (@marcandre) -#28: Add struct_constructor?, class_definition? and module_definition? matchers. (@tejasbubane)

Bug fixes

-#55: Fix ProcessedSource#commented? for multi-line ranges. Renamed contains_comment? (@marcandre) -#69: (Potentially breaking) RetryNode has many errors. It is now a Node. (@marcandre)

0.1.0 (2020-06-26)

New features

-#36: Add post_condition_loop? and loop_keyword? for Node. (@fatkodima) -#38: Add helpers allowing to check whether the method is a nonmutating operator method or a nonmutating method of several core classes. (@fatkodima) -#37: Add enumerable_method? for MethodIdentifierPredicates. (@fatkodima) -#4: Add interpolation? for RegexpNode. (@tejasbubane) -#20: Add option predicates for RegexpNode. (@owst) -#11: Add argument_type? method to make it easy to recognize argument nodes. (@tejasbubane) -#31: NodePattern now uses param === node to match params, which allows Regexp, Proc, Set in addition to Nodes and literals. (@marcandre) -#41: Add delimiters and related predicates for RegexpNode. (@owst) -#46](https://github.com/rubocop/rubocop-ast/pull/46): Basic support for [non-legacy AST output from parser. Note that there is no support (yet) in main RuboCop gem. Expect emit_forward_arg to be set to true in v1.0 (@marcandre) -#48: Support Parser::Ruby28 for Ruby 2.8 (3.0) parser (experimental). (@koic) -#35: NodePattern now accepts %named_param and %CONST. The macros def_node_matcher and def_node_search accept default named parameters. (@marcandre)

0.0.3 (2020-05-15)

Changes

-#7: Classes NodePattern, ProcessedSource and Token moved to AST::NodePattern, etc. The rubocop gem has aliases to ensure compatibility. (@marcandre) -#7: AST::ProcessedSource.from_file now raises a Errno::ENOENT instead of a RuboCop::Error. (@marcandre)

0.0.2 (2020-05-12)

Bug fixes

-Perf #106: Fix RegexpNode#to_regexp where option is 'o' + any other. (@marcandre)

0.0.1 (2020-05-11)