diff options
author | Matthäus G. Chajdas <dev@anteru.net> | 2020-09-19 17:47:45 +0200 |
---|---|---|
committer | Matthäus G. Chajdas <dev@anteru.net> | 2020-09-19 17:47:45 +0200 |
commit | aaad2755835391025286e36ff7df6b27a7ff82c9 (patch) | |
tree | 86f9226b26d345dbbbaff836555e13baf8fac106 /scripts/check_crlf.py | |
parent | 353e52d3e5b3bbb722e83ce4f46a8cba1ccdb07b (diff) | |
download | pygments-git-task/improve-crlf-handling.tar.gz |
Address review feedback.task/improve-crlf-handling
* Remove || true
* Fix docs
* Print the first offending file name
Diffstat (limited to 'scripts/check_crlf.py')
-rw-r--r-- | scripts/check_crlf.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/check_crlf.py b/scripts/check_crlf.py index e82a6717..14442d0e 100644 --- a/scripts/check_crlf.py +++ b/scripts/check_crlf.py @@ -4,7 +4,8 @@ Checker for line endings ~~~~~~~~~~~~~~~~~~~~~~~~ - Make sure each Python does not use Windows-style file endings. + Make sure Python (.py) and Bash completition (.bashcomp) files do not + contain CR/LF newlines. :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. @@ -23,8 +24,10 @@ if __name__ == '__main__': if not filename.endswith('.py') and not filename.endswith('.bashcomp'): continue - with open(os.path.join(root, filename), 'rb') as f: + full_path = os.path.join(root, filename) + with open(full_path, 'rb') as f: if b'\r\n' in f.read(): + print('CR/LF found in', full_path) sys.exit(1) sys.exit(0) |