question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

trailing-whitespace fixer getting false positive

See original GitHub issue

While bringing some Terraform files under pre-commit control, I’ve noticed an issue with files that do not have trailing whitespace but which are being flagged as needing fixing by the trailing-whitespace hook, which is causing a Travis CI build to fail unexpectedly. The files in question seem to trigger because they do not end in a newline, and I believe this to be incorrect behaviour for this hook.

Example repo: https://github.com/digirati-co-uk/pre-commit-hooks-test

This is using v1.2.1 of the pre-commit-hooks repo.

pre-commit-hooks-test-screenshot

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Feb 28, 2018

👍 thanks for the great report.

This is indeed a problem with the hook, I’ll see if I can’t get a fix out for it 😃

Fixing end-of-file is the job of end-of-file-fixer so this hook shouldn’t be doing that!

0reactions
fractoscommented, Mar 1, 2018

Nice one! trailing-whitespace-hook-fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

what is trailing whitespace and how can I handle this?
Trailing whitespace is any spaces or tabs after the last non-whitespace character on the line until the newline. In your posted question, there...
Read more >
Re: [sonar-dev] [SONARJS] Avoid trailing whitespaces
This is an open defect in eclipse stating that there is currently no way to get eclipse to quit adding the whitespace on...
Read more >
Life is Too Short to Review Spaces - GitGuardian Blog
We chose this tool because it is based on a list of common typos, which reduces the number of false positives to a...
Read more >
Whitespace: The Silent Killer - Coding Horror
I have read the comments and I understand that this whitespace can trigger false positives when comparing two versions of a same file...
Read more >
What coding practices are most useful dealing with trailing ...
One of the chronic issues we deal with is code that string comparisons often fail because the stored field may or may not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found