Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Trailing whitespace fixes autofix, take 4 #1991

Closed
wants to merge 5 commits into from

Conversation

lukeapage
Copy link
Contributor

Really the trailing whitespace autofixer needs to be re-written - but in a few comments like #1981 (comment) people are against a simple way of doing it, preferring to instead modify tokens. It was also mentioned a few times that there will be large refactorings to fix in the CST. probably there needs to be a helper function that helps find whitespace in a way that trailing whitespace, dissallow tabs and validate end of line can all use.

Since the CST isn't available I have fixed comments on my patches to the original solution, doing the minimal amount of refactoring. I don't think this will hurt moving to the CST and the tests will be a useful addition in making sure any change is correct.

  1. As noted here : disallowTrailingWhitespace: fix autofix of multiple trailing spaces in a comment #1979 (comment) the unit tests don't currently count any of the logic testing trailing whitespace checking and fixing towards the code coverage. Since no other function is ever going to want to check and fix all trailing whitespace in a file other than the trailing whitespace rule, I've moved the logic to where it can count towards the code coverage, so that I can show I have increased coverage and the fixes can be merged
  2. as per here: disallowTrailingWhitespace: Fix autofixing whitespace on last line #1978 (comment) I've removed the check for precending token so that coverage is higher. I added a test for an empty string, just to be sure.

@markelog markelog closed this in 73a4d95 Nov 21, 2015
@markelog
Copy link
Member

Thank you the for changes and perseverance!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants