Kampfkarren / selene

A blazing-fast modern Lua linter written in Rust
https://kampfkarren.github.io/selene/
Mozilla Public License 2.0
561 stars 76 forks source link

Add fixers #561

Open chriscerie opened 8 months ago

chriscerie commented 8 months ago

Closes #279

This also standardizes handling for code suggestions. Instead of manually inserting try: <code, you would just pass in the suggested code and delineate the suggestion's correctness with Applicability

MachineApplicable suggestions can be applied using selene --fix, MaybeIncorrect can be applied with vscode codeaction, and HasPlaceholders only shows up in output.

selene --fix applies suggestions iteratively, rerunning lints until there's no more suggestions. This handles the edge cases where applying a suggestion triggers another warning. It also handles overlapping suggestions where if multiple ranges overlap, it chooses the innermost one and defers the rest for the next iteration.