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.

mixed-line-ending false positive failure on Windows

See original GitHub issue

Steps to reproduce:

create git repository on Windows platform add file .gitattributes with content: * text=auto setup pre-commit hook with:

mixed-line-ending
      args: ['--fix=lf']

Create text file yourfile.c with CRLF line endigs. Add it to git repository. Stage it. Commit it.

Expected result:

Mixed line ending........................................................Passed as git automatically converts CRLF to LF when commiting

Actual result:

Mixed line ending........................................................Failed
- hook id: mixed-line-ending
- exit code: 1
- files were modified by this hook

stage modified file, git warns you:

Stage 1 files
warning: LF will be replaced by CRLF in yourfile.c.
The file will have its original line endings in your working directory
Done

Commit: Mixed line ending........................................................Passed

At this point, I am not sure which line endings end up committed in repository. Probably LF, as this test passes on server running Linux which checks pull requests.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mkbelcommented, Jan 14, 2020

Thank you for quick response. So if this is technical limitation, I would propose to document it. https://github.com/pre-commit/pre-commit-hooks/pull/437

0reactions
asottilecommented, Jan 14, 2020

that recommendation (afaik) is only due to older tools defaulting to crlf on windows – though most tools on windows work fine with just lf endings now-a-days

Read more comments on GitHub >

github_iconTop Results From Across the Web

Address false positives/negatives in Microsoft Defender for ...
Learn how to handle false positives or false negatives in Microsoft Defender for Endpoint.
Read more >
Salt 2018.3.3 Release Notes
5fee38d1db Fixes various tests that were failing under python 3.7. ... 53ba10ad5f Skip pylint false-positives.
Read more >
Writing better Python code, automatically - mje.nz
It produces more false positives than Flake8 but also catches more bugs, ... MASTER] disable = # Fails in pre-commit venv import-error, ...
Read more >
flux-core
stop-on-failure=N Automatically stop a cron entry if the failure count ... success True of False if job completed successfully, empty string ...
Read more >
Microsoft Defender is detecting a false-positive threat "Win32 ...
This detection is not malware , but a bug, so check that you have the latest security intelligence update to fix the issue...
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