etiennebacher / flint

Find and Fix Lints in R Code
https://flint.etiennebacher.com
Other
42 stars 1 forks source link

Equivalence with `lintr` #6

Open etiennebacher opened 5 months ago

etiennebacher commented 5 months ago

https://lintr.r-lib.org/dev/reference/#individual-linters

etiennebacher commented 3 months ago

For unnecessary_nested_if_linter: https://ast-grep.github.io/playground.html#eyJtb2RlIjoiQ29uZmlnIiwibGFuZyI6ImphdmFzY3JpcHQiLCJxdWVyeSI6IiIsInJld3JpdGUiOiJsb2dnZXIubG9nKCRNQVRDSCkiLCJzdHJpY3RuZXNzIjoic21hcnQiLCJzZWxlY3RvciI6IiIsImNvbmZpZyI6InJ1bGU6XG4gIGtpbmQ6IGlmX3N0YXRlbWVudFxuICBoYXM6XG4gICAga2luZDogc3RhdGVtZW50X2Jsb2NrXG4gICAgaGFzOiAgXG4gICAgICBraW5kOiBpZl9zdGF0ZW1lbnRcbiAgICAgIHN0b3BCeTogbmVpZ2hib3JcbiAgICBub3Q6XG4gICAgICBoYXM6XG4gICAgICAgIG50aENoaWxkOiAyXG4iLCJzb3VyY2UiOiJpZiAoQSkge1xuICBpZiAoQikge1xuICAgIGNvbnNvbGUubG9nKCdtYXRjaGVkIGluIG1ldGF2YXIhJylcbiAgfVxufVxuXG5pZiAoQSkge1xuICBpZiAoQikge1xuICAgIGNvbnNvbGUubG9nKCdtYXRjaGVkIGluIG1ldGF2YXIhJylcbiAgfVxuICBsZXQgeCA9IDE7XG59XG5cbmlmIChBKSB7XG4gIGxldCB4ID0gMTtcbiAgaWYgKEIpIHtcbiAgICBjb25zb2xlLmxvZygnbWF0Y2hlZCBpbiBtZXRhdmFyIScpXG4gIH1cbn0ifQ==

etiennebacher commented 2 months ago

I think a linter shouldn't take care of whitespaces and other things that don't modify the AST but are "purely aesthetic", that's the role of a formatter (and I don't think ast-grep is the right tool for this). So I remove from the list all linters related to formatting.