Improve validator CLI safety, detailed reporting, and documentation#12
Improve validator CLI safety, detailed reporting, and documentation#12
Conversation
…alidation - Simplify ValidationResult: remove is_positive_test() and is_negative_test() - Update passed() to directly return conformance status - Refactor validate.py to group by conformance (valid/invalid) instead of test expectations - Files can now be located anywhere without folder structure constraints - Works with any example datasets regardless of naming conventions
There was a problem hiding this comment.
Pull request overview
This PR updates the SHACL validation CLI to keep terminal output manageable during large directory runs while still persisting full diagnostics to a report file, and documents the updated CLI defaults/options.
Changes:
- Added detailed report generation to a configurable
--report-filepath (defaultlogs/validation-report.txt) and kept terminal output compact with optional verbosity. - Added optional per-file timeout and per-file progress output for directory validation.
- Updated top-level and docs README CLI documentation and ignored the generated logs directory.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/validator.py |
Adds SIGALRM-based per-file timeout plumbing and adjusts validation result semantics. |
scripts/validate.py |
Adds report writer, CLI flags (--report-file, --max-files-report, --timeout, --progress), and compact directory output behavior. |
README.md |
Documents CLI defaults, report behavior, and tuning options. |
docs/README.md |
Expands CLI option documentation and usage examples. |
.gitignore |
Ignores /logs/ to avoid committing generated reports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
scripts/validate.py
Outdated
| return True, result, None | ||
|
|
||
| return True # Return True if file was successfully validated (regardless of result) |
There was a problem hiding this comment.
validate_single_file() now returns True whenever the file loads/validates without a loader error, even if result.conforms is False. Since main() uses this boolean to decide the process exit code, an invalid single-file validation will currently exit 0, which makes it hard to use the CLI in CI or scripting. Consider returning result.conforms (or providing a dedicated flag to ignore conformance in exit status).
| return True, result, None | |
| return True # Return True if file was successfully validated (regardless of result) | |
| return result.conforms, result, None | |
| return result.conforms |
That is good proposal. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
That is good proposal. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Also good proposal. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
this is good. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…EAL state Agent-Logs-Url: https://github.com/mobilityDCAT-AP/validation/sessions/a49a134a-22aa-4851-9149-70c09aebcdb2 Co-authored-by: atibaut <2762514+atibaut@users.noreply.github.com>
Summary
This PR improves the validation workflow to prevent terminal overload during large runs while preserving full diagnostics in a report file. It also clarifies CLI behavior and separates universal validation from suite-style testing.
Why
Large validation runs can produce very high terminal output, which can degrade VS Code responsiveness. We needed:
Workflow separation (new)
The repository now has two distinct CLI workflows:
scripts/validate.pyscripts/validate_suite.pypositives/negativesPASS/FAIL/UNCLASSIFIEDThis removes ambiguity and keeps test-suite semantics out of the generic validator.
What changed
scripts/validate.py.scripts/validate.py.logs/validation-report.txt--max-files-report(0means unlimited)scripts/validate.py.scripts/validator.py.ValidationResult.passed()semantics from model layer.scripts/validate_suite.pyfor expected-outcome testing..gitignore.Validation and testing performed
Notes
Files changed
.gitignoreREADME.mddocs/README.mdscripts/validate.pyscripts/validate_suite.pyscripts/validator.py