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

Auto ignore offenses with corrections over the size limit #8290

Open
marcandre opened this issue Jul 9, 2020 · 3 comments
Open

Auto ignore offenses with corrections over the size limit #8290

marcandre opened this issue Jul 9, 2020 · 3 comments
Assignees

Comments

@marcandre
Copy link
Contributor

I see multiple errors #8203, #8025, #8283 that all have the same pattern: a Style cop wants to do an auto-correction and goes through hoops to see if the correction would create too long a line.

This feels like an anti-pattern: the cop should add the offense and provide the auto-correction with a flag saying "hey, just ignore me if this is too long". The engine has all the necessary information to ignore it or not.

Is it worth doing?
cc/ @Drenmi @jonas054

@jonas054
Copy link
Collaborator

But the cop should also refrain from reporting the offense in the first place, if correcting it would yield a line that's too long. So it would have to always run the auto-correction logic, even if --auto-correct was not given. To me, this seems complicated, and I would prefer to keep things as they are. Unless someone has an elegant solution to convince me. 🙂

@marcandre
Copy link
Contributor Author

So it would have to always run the auto-correction logic, even if --auto-correct was not given.

Correct.

To me, this seems complicated

I'm not sure it is. I would make a copy of the corrector, do a remove for all lines before and after it, apply it and check the length of the resulting lines.

I think the resulting LOC would be about what it takes just to to implement the current check on #8203

@marcandre marcandre self-assigned this Jul 23, 2020
@marcandre
Copy link
Contributor Author

Related: #6077

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

No branches or pull requests

2 participants