Does RuboCop "check the AST" on the changes it is doing? #13546
-
|
Inspired by #13499 (comment), and what I know by https://black.readthedocs.io/en/stable/*: Could RuboCop compare the AST, to avoid creating issues such as when operator precedence is involved, or (implict) block starting which does not require parentheses, but the rewrite does require parentheses to keep semantics^? I feel like, if that were the case, issues like #13299 would not have happened. *: Ik that black is only a formatter, therefore "maybe" easier than RuboCop. But the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
I was actually looking into doing that after I made that comment but there are reasons that the AST could change without changing operator precedence. For instance, this test: rubocop/spec/rubocop/cop/style/block_delimiters_spec.rb Lines 407 to 426 in 1b237c6 The AST changes (a Adding parentheses around a node also inserts a |
Beta Was this translation helpful? Give feedback.
I was actually looking into doing that after I made that comment but there are reasons that the AST could change without changing operator precedence.
For instance, this test:
rubocop/spec/rubocop/cop/style/block_delimiters_spec.rb
Lines 407 to 426 in 1b237c6
T…