Skip to content

Commit 996354b

Browse files
committed
fix: resolve linting and IO review feedback
1 parent a4a95dc commit 996354b

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

scripts/qa_report.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from a2ui.schema.common_modifiers import remove_strict_validation
3434
from a2ui.schema.constants import VERSION_0_9
3535

36+
3637
def run_validation():
3738
print(f"Starting QA Validation against A2UI v{VERSION_0_9}...")
3839

@@ -113,10 +114,9 @@ def run_validation():
113114
catalog = manager.get_selected_catalog()
114115

115116
for filename in sorted(os.listdir(examples_dir)):
116-
if not filename.endswith(".json"):
117-
continue
118-
119117
filepath = examples_dir / filename
118+
if not filepath.is_file() or not filename.endswith(".json"):
119+
continue
120120
total_examples += 1
121121

122122
try:
@@ -127,7 +127,8 @@ def run_validation():
127127
report_content.append(f"- ✅ `{filename}`: Passed")
128128
passed_examples += 1
129129
except Exception as e:
130-
err_str = str(e).replace('\n', ' ')
130+
err_msg = getattr(e, 'message', str(e))
131+
err_str = str(err_msg).replace('\n', ' ')
131132
report_content.append(f"- ❌ `{filename}`: Failed ({err_str})")
132133
failed_examples.append(f"{sample_name}/{filename}")
133134

@@ -146,7 +147,7 @@ def run_validation():
146147
report_content.append(f"- **Failed:** {len(failed_examples)}")
147148

148149
report_str = "\n".join(report_content)
149-
with open(report_path, "w") as f:
150+
with open(report_path, "w", encoding="utf-8") as f:
150151
f.write(report_str)
151152

152153
print(f"\nQA Report generated at: {report_path}")
@@ -158,5 +159,6 @@ def run_validation():
158159
print("Validation finished successfully.")
159160
sys.exit(0)
160161

162+
161163
if __name__ == "__main__":
162164
run_validation()

0 commit comments

Comments
 (0)