Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixers #561

Open
wants to merge 70 commits into
base: main
Choose a base branch
from
Open

Add fixers #561

wants to merge 70 commits into from

Conversation

chriscerie
Copy link
Collaborator

@chriscerie chriscerie commented Oct 14, 2023

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.

@chriscerie chriscerie changed the title Add fixes Add fixers Oct 14, 2023
Comment on lines -99 to +228
pretty_assertions::assert_eq!(PrettyString(&expected), PrettyString(stderr));
pretty_assertions::assert_eq!(
PrettyString(&expected.replace("\r\n", "\n")),
PrettyString(&stderr.to_string().replace("\r\n", "\n"))
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without normalizing, this one specific lint fails. I'm confused why this wasn't an issue previously and for the others.

@chriscerie chriscerie marked this pull request as ready for review October 19, 2023 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selene fix
1 participant