lint: Use C.UTF-8 locale only in shell scripts

This commit is contained in:
Hennadii Stepanov
2026-07-26 16:45:39 +01:00
parent 982ee64938
commit 46654094be

View File

@@ -5,8 +5,8 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Make sure all shell scripts explicitly opt out of locale dependence using
"export LC_ALL=C" or "export LC_ALL=C.UTF-8", which also enables UTF-8 mode in
Make sure all shell scripts explicitly opt out of locale dependence
using "export LC_ALL=C.UTF-8", which also enables UTF-8 mode in
Python. See: https://docs.python.org/3/library/os.html#python-utf-8-mode
"""
@@ -15,7 +15,6 @@ import sys
import re
OPT_OUT_LINES = [
'export LC_ALL=C',
'export LC_ALL=C.UTF-8',
]
@@ -51,7 +50,7 @@ def main():
first_non_comment_line = non_comment_lines[0]
if first_non_comment_line not in OPT_OUT_LINES:
print(f'Missing "export LC_ALL=C" (to avoid locale dependence) as first non-comment non-empty line in {file_path}')
print(f'Missing "export LC_ALL=C.UTF-8" (to avoid locale dependence) as first non-comment non-empty line in {file_path}')
exit_code = 1
return sys.exit(exit_code)