-
Notifications
You must be signed in to change notification settings - Fork 226
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
Whitespace linting rules cannot be disabled #764
Comments
Synced to Apple’s issue tracker as rdar://131043378 |
I was thinking about this a bit... if format mode would remove blank lines or trailing whitespace, then doesn't it make sense for lint mode to report it as a warning, since these changes would be made if the formatter was run? Or is this a scenario where it is only being used in lint mode? The number of line breaks allowed can be controlled with |
That's true... the question is whether we expect any formatting to run if no rules are enabled and whether we should allow turning on/off eg. indentation/spacing/trailing whitespace/line removal/etc. Right now there's no way to turn off the basic whitespace formatting. |
Not exactly on-topic: I think a good place to be is have (an) option(s) that make(s) lint mode to not complain about anything format mode can't fix. |
Whitespace formatting can be turned off with the hidden command line option |
Oh interesting, TIL.
Maybe, though it seems like it would be nice to be able to run certain parts - ie. maybe I only want to indent, but not change any other formatting. |
I do enjoy the ability to re-indent code without changing much else, but this might be a bit counter to how the formatter is currently working and is likely a big change (especially in testing). I think that this would also boil down to be a very similar request as #470, so that discussion is likely relevant. |
The reason |
Thanks for the details @allevato 🙇♂️. Probably depends on the exact cases in the transforms. In general BasicFormat will only insert trivia where necessary to form valid source. Would be interesting to try, though I imagine there's cases where we'd end up with something fairly odd (extra whitespace where there should be any, for example). Could generalize this a little less and instead have a "indent only" option, which does seem relatively useful? |
With this as my
.swift-format
:I still get the whitespace linting rules, e.g:
Seems like there ought to be a way to disable them if desired.
The text was updated successfully, but these errors were encountered: