Skip to content

Commit beee131

Browse files
committed
BUG: Fix json description file line ending check
CRLF line endings were not detected, therefore they were only noticed by the linter, which did not give any useful hints about what was wrong with the json file.
1 parent 0eb83c0 commit beee131

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/check_description_files.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ def check_json_file_format(extension_name, metadata, extension_file_path):
105105
extension_name, check_name,
106106
f"Invalid JSON format: {str(e)}")
107107
# Force using LF-only line endings
108-
with open(extension_file_path, 'r', encoding='utf-8') as f:
108+
# Must open in binary mode to detect line endings
109+
with open(extension_file_path, 'rb') as f:
109110
content = f.read()
110-
if '\r\n' in content or '\r' in content:
111+
if b'\r\n' in content or b'\r' in content:
111112
raise ExtensionCheckError(
112113
extension_name, check_name,
113114
"File contains non-LF line endings (CR or CRLF). Please convert to LF-only line endings.")

0 commit comments

Comments
 (0)