Skip to content

Commit 6879ce5

Browse files
SCANPY-327 Addressed reviewer comments
1 parent 20229e9 commit 6879ce5

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

src/pysonar_scanner/dry_run_reporter.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ def report_validation_results(validation_result: "ValidationResult") -> int:
8080
logging.info("=" * 80)
8181

8282
if validation_result.is_valid():
83+
for warning in validation_result.warnings:
84+
logging.warning(f" • {warning}")
8385
logging.info("✓ Configuration validation PASSED")
8486
logging.info("=" * 80)
8587
return 0
@@ -182,26 +184,6 @@ def _validate_single_report(
182184
)
183185
return
184186

185-
# Check if it's readable
186-
try:
187-
with open(full_path, "r", encoding="utf-8") as f:
188-
f.read(1) # Try to read first byte
189-
except PermissionError:
190-
validation_result.add_error(
191-
f"Coverage report is not readable (permission denied): {report_path}"
192-
)
193-
return
194-
except UnicodeDecodeError:
195-
validation_result.add_warning(
196-
f"Coverage report may not be text-based (is it in binary format?): {report_path}"
197-
)
198-
return
199-
except Exception as e:
200-
validation_result.add_error(
201-
f"Error reading coverage report {report_path}: {str(e)}"
202-
)
203-
return
204-
205187
try:
206188
with open(full_path, "r", encoding="utf-8") as f:
207189
tree = ET.parse(f)
@@ -212,6 +194,14 @@ def _validate_single_report(
212194
)
213195
else:
214196
logging.info(f" ✓ Coverage report is valid Cobertura XML: {report_path}")
197+
except PermissionError:
198+
validation_result.add_error(
199+
f"Coverage report is not readable (permission denied): {report_path}"
200+
)
201+
except UnicodeDecodeError:
202+
validation_result.add_warning(
203+
f"Coverage report may not be text-based (is it in binary format?): {report_path}"
204+
)
215205
except ET.ParseError as e:
216206
validation_result.add_error(
217207
f"Coverage report is not valid XML (Cobertura format): {report_path}\n"

0 commit comments

Comments
 (0)