From d703a2ee19c16790be83414daa324cac06817bb0 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 1 Apr 2020 13:35:46 +0200 Subject: [PATCH] In Windows files, detect CR without LF as well as LF without CR Signed-off-by: Gilles Peskine --- tests/scripts/check-files.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scripts/check-files.py b/tests/scripts/check-files.py index e4a365f16..1a9ba309a 100755 --- a/tests/scripts/check-files.py +++ b/tests/scripts/check-files.py @@ -140,7 +140,7 @@ class UnixLineEndingIssueTracker(LineIssueTracker): class WindowsLineEndingIssueTracker(LineIssueTracker): - """Track files with non-Windows line endings (i.e. files without CR).""" + """Track files with non-Windows line endings (i.e. CR or LF not in CRLF).""" heading = "Non-Windows line endings:" @@ -148,7 +148,7 @@ class WindowsLineEndingIssueTracker(LineIssueTracker): return is_windows_file(filepath) def issue_with_line(self, line, _filepath): - return not line.endswith(b"\r\n") + return not line.endswith(b"\r\n") or b"\r" in line[:-2] class TrailingWhitespaceIssueTracker(LineIssueTracker):