Refactor CLI report handling and add version/no-fail options#6
Open
lukegre wants to merge 2 commits into
Open
Conversation
- Add __version__ via importlib.metadata to nc_check.__init__ - CLI: --version flag, --no-fail flag, meaningful exit codes (non-zero on check failures), fix _normalize_check_argv to skip leading flags before injecting 'compliance' - CLI: decouple check execution (always report_format="python") from rendering (_render_check_report), enabling exit-code logic based on collected dict - HTML reports: sticky action bar, dark-mode via prefers-color-scheme, copy-to-clipboard buttons on all <pre> blocks - HTML reports: version + generated-date stamp in subtitles of ocean, time-cover, and full reports https://claude.ai/code/session_01Ss5iprT8oNfgrdaVEznYLk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors the CLI report handling to separate report generation from rendering, adds
--versionand--no-failcommand-line options, improves HTML report styling with dark mode support and copy-to-clipboard functionality, and enhances the argument normalization logic.Key Changes
Report Generation Refactoring: Modified all check functions to return reports in "python" format internally, then render them separately via a new
_render_check_report()function. This decouples report generation from output formatting.New CLI Options:
--versionflag to display the package version--no-failflag to exit with code 0 even when checks fail (useful for CI reporting-only pipelines)Improved Argument Normalization: Enhanced
_normalize_check_argv()to correctly handle leading option flags (e.g.,nc-check --no-fail input.ncnow properly normalizes tonc-check --no-fail compliance input.nc)HTML Report Enhancements:
<pre>code blocks with visual feedbackReport Failure Detection: Added
_report_failed()function to determine if a report indicates check failures, enabling proper exit code handling with the--no-failoptionVersion Management: Exported
__version__from the main package module for use in CLI and report generationImplementation Details
_run_all_checks()function signature was simplified by removingreport_formatandreport_html_fileparametersprefers-color-schememedia query for automatic theme detectionhttps://claude.ai/code/session_01Ss5iprT8oNfgrdaVEznYLk