This is a specific type of rule. It can be used in the more general ruleset
built with ast_rule()
.
Details
The strictness
parameter defines the type of nodes the ast-grep
matcher
should consider. It has the following values:
cst
: All nodes in the pattern and target code must be matched. No node is skipped.smart
: All nodes in the pattern must be matched, but it will skip unnamed nodes in target code. This is the default behavior.ast
: Only named AST nodes in both pattern and target code are matched. All unnamed nodes are skipped.relaxed
: Named AST nodes in both pattern and target code are matched. Comments and unnamed nodes are ignored.signature
: Only named AST nodes' kinds are matched. Comments, unnamed nodes and text are ignored.
More information: https://ast-grep.github.io/guide/rule-config/atomic-rule.html#pattern-object