Skip to content

Add fixers#561

Open
chriscerie wants to merge 70 commits intoKampfkarren:mainfrom
chriscerie:fixes
Open

Add fixers#561
chriscerie wants to merge 70 commits intoKampfkarren:mainfrom
chriscerie:fixes

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 force-pushed the fixes branch 2 times, most recently from ae7555e to 7af2433 Compare October 14, 2023 18:00
@chriscerie chriscerie force-pushed the fixes branch 3 times, most recently from dae8f5f to 251bc5b Compare October 14, 2023 20:02
@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