Skip to content
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

trailing-whitespace: add option for custom chars to strip #421

Merged
merged 7 commits into from
Oct 25, 2019

Conversation

iconmaster5326
Copy link
Contributor

This PR adds a new flag to the trailing-whitespace hook, --chars, which allows you to specify a custom set of characters to pass to rstrip.

This flag was motivated by Common Lisp, in which a common convention is to use \f to delineate sections of code. trailing-whitespace considers these by default whitespace, and so strips out the section delimiters users want to preserve. In repositories where this convention is used, a custom value for --chars can be specified. This hook is general enough to be used in other use cases if need be, however.

Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine, a little weird, but fine

pre_commit_hooks/trailing_whitespace_fixer.py Outdated Show resolved Hide resolved
pre_commit_hooks/trailing_whitespace_fixer.py Outdated Show resolved Hide resolved
pre_commit_hooks/trailing_whitespace_fixer.py Outdated Show resolved Hide resolved
pre_commit_hooks/trailing_whitespace_fixer.py Outdated Show resolved Hide resolved
pre_commit_hooks/trailing_whitespace_fixer.py Outdated Show resolved Hide resolved
Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asottile asottile merged commit d61d4a2 into pre-commit:master Oct 25, 2019
@asottile
Copy link
Member

this has been released in v2.4.0!

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

Successfully merging this pull request may close these issues.

None yet

2 participants