Skip to content

Refactor CLI report handling and add version/no-fail options#6

Open
lukegre wants to merge 2 commits into
mainfrom
claude/improve-package-ui-TJlh5
Open

Refactor CLI report handling and add version/no-fail options#6
lukegre wants to merge 2 commits into
mainfrom
claude/improve-package-ui-TJlh5

Conversation

@lukegre
Copy link
Copy Markdown
Owner

@lukegre lukegre commented Apr 7, 2026

Summary

This PR refactors the CLI report handling to separate report generation from rendering, adds --version and --no-fail command-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:

    • Added --version flag to display the package version
    • Added --no-fail flag 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.nc now properly normalizes to nc-check --no-fail compliance input.nc)

  • HTML Report Enhancements:

    • Added dark mode CSS with color scheme preferences
    • Made report action buttons sticky at the top with backdrop blur effect
    • Added copy-to-clipboard buttons for <pre> code blocks with visual feedback
    • Added version and generation date stamps to all HTML report subtitles
  • Report Failure Detection: Added _report_failed() function to determine if a report indicates check failures, enabling proper exit code handling with the --no-fail option

  • Version Management: Exported __version__ from the main package module for use in CLI and report generation

Implementation Details

  • Report rendering now happens after all checks complete, allowing consistent handling across all check modes (compliance, ocean-cover, time-cover, all)
  • The _run_all_checks() function signature was simplified by removing report_format and report_html_file parameters
  • HTML reports now include metadata (version, generation date) for better traceability
  • Dark mode styling uses CSS custom properties and prefers-color-scheme media query for automatic theme detection

https://claude.ai/code/session_01Ss5iprT8oNfgrdaVEznYLk

claude and others added 2 commits April 4, 2026 20:08
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants