Skip to content

rubocop/rubocop-ast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6b91362 · Mar 25, 2025
Mar 3, 2025
Mar 25, 2025
Mar 25, 2025
Mar 25, 2025
Mar 25, 2025
Mar 25, 2025
Mar 21, 2025
Sep 27, 2020
Nov 2, 2024
May 12, 2020
Feb 24, 2025
Nov 2, 2024
Mar 25, 2025
Nov 9, 2021
Mar 25, 2025
May 12, 2020
Aug 8, 2024
Feb 27, 2024
Nov 9, 2021
Mar 25, 2025

Repository files navigation

RuboCop AST

Gem Version CI Test Coverage Maintainability

Contains the classes needed by RuboCop to deal with Ruby's AST, in particular:

  • RuboCop::AST::Node (doc)
  • RuboCop::AST::NodePattern (doc)

This gem may be used independently from the main RuboCop gem. It was extracted from RuboCop in version 0.84 and its only dependency is the parser gem, which rubocop-ast extends.

Installation

Just install the rubocop-ast gem

gem install rubocop-ast

or if you use bundler put this in your Gemfile

gem 'rubocop-ast'

Usage

Refer to the documentation of RuboCop::AST::Node and RuboCop::AST::NodePattern

See the docs site for more details.

Parser compatibility switches

This gem, by default, uses most legacy AST output from parser, except for the following which are set to true:

  • emit_forward_arg
  • emit_match_pattern

The main RuboCop gem uses these defaults (and is currently only compatible with these), but this gem can be used separately from RuboCop and is meant to be compatible with all settings. For example, to have -> { ... } emitted as LambdaNode instead of SendNode:

RuboCop::AST::Builder.emit_lambda = true

Contributing

Checkout the contribution guidelines.

License

rubocop-ast is MIT licensed. See the accompanying file for the full text.