Fix: Use context manager for file reads (with open(...) as f)

This commit is contained in:
Amit Verma 2025-10-06 01:33:54 +05:30 committed by GitHub
parent 39332e76ce
commit 6bf42edf13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -210,7 +210,8 @@ def lint_file(path, cfg):
# Try to read the file content and handle potential errors
try:
lines = open(path, encoding='utf-8').read().splitlines()
with open(path, encoding='utf-8') as f:
lines = f.read().splitlines()
except Exception as e:
return [f"::error file={path},line=1::Cannot read file: {e}"] # Return as a list of issues