-
Notifications
You must be signed in to change notification settings - Fork 14
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
Difference between dirty and clean #44
Comments
The difference between dirty and clean whitespace is that dirty whitespace is highlighted and clean whitespace is cleaned on save. When you are working on a project which has clean whitespace already, clean whitespace prevents you from introducing bad whitespace. If you are working on a project which does not have clean whitespace, dirty whitespace helps you see where the bad whitespace is. This can be helpful because you may need to reintroduce bad whitespace to minimize a diff, or you may be able to fix whitespace on a line that you are about to change. Yes, if the whitespace is highlighted, then that category of whitespace is understood to be dirty. Does that help? If you have suggestions for how to better explain this, I'm open to suggestions! |
Sorry, this doesn't answer my question which was "what the difference is between dirty and clean whitespaces". I have understand how your package treat that two types of whitespaces. But I didn't understand how your package decide which type one whitespace is. |
|
But what makes a white space "clean" or "dirty"? |
Oh! I think I understand your question now. You're not looking for a technical explanation of how the package works but more like a theoretical explanation of what "dirty" means, right? The goal is that the contents of a file should have exactly one representation on disk. If there are multiple possible representations for on-disk content, then it's possible to have diffs that move from one representation to another (and thus, causing a diff) without having any semantic change. Any whitespace which can contribute to the file having multiple representations is considered an "error" and any file with errors is "dirty". It's the same principle as having automatic code formatting -- by eliminating all representations except one, you eliminate discussions about formatting and style. When the whitespace is formatted correctly, the file is clean. There are multiple categories of whitespace that |
I'm switching from
ws-buttler
(which seems dead) to your nice package.From the documentation it is not clear for me what the difference is between dirty and clean whitespaces?
I also of "empty" lines only containing whitespaces in a python file. But that whitespaces are highlighted by your package. This means they are "dirty" and not cleaned on the next save: Am I right?
The text was updated successfully, but these errors were encountered: