Skip to content

Commit da90539

Browse files
fix:added better types
1 parent 1709ab0 commit da90539

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/scripts/detect_ts_ignore.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import argparse
22
import sys
33

4-
def check_ts_ignore(files):
4+
def check_ts_ignore(files: list[str]) -> int:
55
"""
66
Checks for occurrences of '@ts-ignore' in the given files.
77
@@ -15,14 +15,14 @@ def check_ts_ignore(files):
1515

1616
for file in files:
1717
try:
18-
with open(file, "r", encoding="utf-8") as f:
18+
with open(file, encoding="utf-8") as f:
1919
for line_num, line in enumerate(f, start=1):
2020
if "@ts-ignore" in line:
2121
print(f"❌ Error: '@ts-ignore' found in {file} at line {line_num}")
2222
ts_ignore_found = True
2323
except FileNotFoundError:
2424
print(f"⚠️ Warning: File not found: {file}")
25-
except Exception as e:
25+
except (IOError, OSError) as e:
2626
print(f"⚠️ Warning: Could not read {file}: {e}")
2727

2828
return 1 if ts_ignore_found else 0

0 commit comments

Comments
 (0)