Skip to content

Commit

Permalink
Fix codecheck.py for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
TheQuantumPhysicist committed May 15, 2024
1 parent 524ff9c commit 08749a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions build-tools/codecheck/codecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def disallow(pat, exclude = []):

found_re = False
for path in rs_sources(exclude):
with open(path) as file:
with open(path, 'r', encoding='utf-8') as file:
for (line_num, line) in enumerate(file, start = 1):
line = line.rstrip()
if pat.search(line):
Expand Down Expand Up @@ -272,7 +272,7 @@ def check_local_licenses():
for exempted in exempted_files):
continue

with open(path) as file:
with open(path, 'r', encoding='utf-8') as file:
if not template.search(file.read()):
ok = False
print("{}: License missing or incorrect".format(path))
Expand All @@ -295,7 +295,7 @@ def check_todos():
for exempted in exempted_files):
continue

with open(path) as file:
with open(path, 'r', encoding='utf-8') as file:
file_data = file.read()
if 'TODO(PR)' in file_data or 'FIXME' in file_data:
ok = False
Expand All @@ -306,7 +306,7 @@ def check_todos():


def file_ends_with_newline(file_path):
with open(file_path, 'r') as file:
with open(file_path, 'r', encoding='utf-8') as file:
file_data = file.read()
if len(file_data) == 0:
# Exclude empty files
Expand Down Expand Up @@ -358,7 +358,7 @@ def check_trailing_whitespaces():
for exempted in exempted_files):
continue

with open(path) as file:
with open(path, 'r', encoding='utf-8') as file:
try:
for line_idx, line in enumerate(file, start=1):
line = line.rstrip('\n\r')
Expand Down

0 comments on commit 08749a6

Please sign in to comment.