Page MenuHomePhabricator

Add a option to lint trailing whitespace only on non-empty lines
AbandonedPublic

Authored by iana on Dec 1 2017, 1:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 13, 9:13 AM
Unknown Object (File)
Sat, Apr 13, 8:34 AM
Unknown Object (File)
Sat, Apr 13, 8:33 AM
Unknown Object (File)
Tue, Apr 9, 10:47 PM
Unknown Object (File)
Sat, Mar 23, 6:08 AM
Unknown Object (File)
Mar 10 2024, 2:18 AM
Unknown Object (File)
Jan 31 2024, 2:51 PM
Unknown Object (File)
Jan 23 2024, 1:21 AM
Subscribers

Details

Reviewers
None
Summary

(Apologies in advance if I have completely messed up the process, it's my first time. I did read all of the "Contributing" guidelines so I tried to do it right!)

Add a 'text.trailing-whitespace-non-empty-only' option to ArcanistTextLinter to allow for the trailing whitespace check to only apply to non-empty lines. This makes it cooperate better with editors like Xcode that maintain the indent level on empty lines.

This intends to satisfy the feature request logged at https://discourse.phabricator-community.org/t/feature-request-trailing-whitespace-only-on-non-empty-lines/806/1 (I couldn't figure out how to create a Feature Request task on this Phabricator instance.)

Test Plan

Verified that with text.trailing-whitespace-non-empty-only on, only non-empty lines are reported. Verified with it unset or false that no behavior change occurs.

Added a new unit test.

Event Timeline

iana requested review of this revision.Dec 1 2017, 1:03 AM

Sorry, I'm not interested in bringing this change upstream.

XCode appears to have a settings checkbox to change this behavior, which I think is a better approach here. Alternatively, you can implement this as a third-party extension if you prefer XCode's behavior.

xcode.png (708×862 px, 122 KB)

Sorry, I'm not interested in bringing this change upstream.

XCode appears to have a settings checkbox to change this behavior, which I think is a better approach here. Alternatively, you can implement this as a third-party extension if you prefer XCode's behavior.

xcode.png (708×862 px, 122 KB)

Alright, thanks for taking a look. I'll just convert this into a custom linter for my project then.