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)
Jul 10 2026, 8:20 PM
Unknown Object (File)
Jul 4 2026, 4:48 AM
Unknown Object (File)
Feb 26 2026, 4:09 PM
Unknown Object (File)
Jan 23 2026, 9:17 AM
Unknown Object (File)
Dec 5 2025, 3:20 AM
Unknown Object (File)
Oct 5 2025, 4:02 PM
Unknown Object (File)
Oct 4 2025, 3:18 AM
Unknown Object (File)
Sep 30 2025, 2:38 PM
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.