Skip to content

test+docs: raise CLI scan coverage and add CI scan examples#275

Merged
fernandotonon merged 4 commits into
masterfrom
codex/coverage-over-80-refresh
Apr 10, 2026
Merged

test+docs: raise CLI scan coverage and add CI scan examples#275
fernandotonon merged 4 commits into
masterfrom
codex/coverage-over-80-refresh

Conversation

@fernandotonon
Copy link
Copy Markdown
Owner

@fernandotonon fernandotonon commented Apr 9, 2026

Summary

  • add focused CLIPipeline::cmdScan tests to cover new scan command paths
  • add MainWindow tests for pivot shortcut and group/ungroup action behavior
  • expand docs with explicit scan examples for:
    • GitHub Actions (reusable action + Docker usage)
    • GitLab CI (.gitlab-ci.yml job + artifacts)

Why

Recent feature additions reduced coverage. These tests target quick-win uncovered paths, and docs now include copy/paste CI examples for scan in both GitHub Actions and GitLab.

Changes

  • src/CLIPipeline_test.cpp
    • config-not-found / invalid --fail-on / invalid scan root
    • include pattern normalization (*.fbx -> nested matches)
    • report + SARIF generation paths
    • auto-detected qtmesh.yml report outputs
  • src/mainwindow_test.cpp
    • P shortcut cycles pivot mode
    • group/ungroup enablement and flow behavior
  • website/src/DocsApp.jsx
    • explicit scan example in GitHub Actions section
    • new GitLab CI section with scan job

Validation

  • targeted new tests pass locally
  • website docs build passes (npm ci && npm run build)

Summary by CodeRabbit

  • Tests
    • Added CLI scan tests for error and success paths, include-pattern handling, and config auto-detection; added UI tests for grouping/ungrouping and pivot-mode keyboard behavior.
  • Documentation
    • Added a GitLab CI integration guide and updated the GitHub Actions example to demonstrate scanning with SARIF/JSON report generation and failure-on-error behavior.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1a57eb7d-22f6-4ffc-9fcc-65710b4a8c8b

📥 Commits

Reviewing files that changed from the base of the PR and between 9cfc829 and 612cd30.

📒 Files selected for processing (1)
  • website/src/DocsApp.jsx
✅ Files skipped from review due to trivial changes (1)
  • website/src/DocsApp.jsx

📝 Walkthrough

Walkthrough

Adds CLI scan tests (error and success paths, include-patterns, config autodetection), new MainWindow UI interaction tests for pivot/group/ungroup behavior, and documentation updates adding a GitLab CI example and adjusting the GitHub Actions snippet.

Changes

Cohort / File(s) Summary
CLI Pipeline Test Suite
src/CLIPipeline_test.cpp
Added QTemporaryDir usage and an anonymous ScopedCurrentDir RAII helper. Introduced cmdScan tests covering error cases (missing --config, invalid --fail-on, non-directory scan root — expect rc=2), success paths (JSON and SARIF outputs for invalid .fbx with --fail-on never), include-pattern handling (--include *.fbx), and config autodetection when qtmesh.yml is in CWD.
MainWindow UI Tests
src/mainwindow_test.cpp
Added four MainWindowTest cases: pivot-mode cycling via Qt::Key_P; group/ungroup action enablement transitions as selection changes; groupSelected() behavior (collapses selection to group node and enables ungroup); ungroupSelected() behavior for group vs non-group nodes.
Docs / CI Examples
website/src/DocsApp.jsx
Added "GitLab CI" integration entry and .gitlab-ci.yml example that runs qtmesheditor --cli scan on ${CI_PROJECT_DIR}/assets with ${CI_PROJECT_DIR}/qtmesh.yml, emits SARIF/JSON, fails on errors, and uploads artifacts. Updated GitHub Actions example to use scan over assets with explicit ref and report outputs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Poem

🐰
I hopped into tests with cheer,
Scanned the files both far and near,
Groups and pivots danced in play,
GitLab CI joins the day,
Reports arrived — a crunchy carrot near! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main changes: expanding test coverage for CLI scan and adding CI scan examples to documentation.
Description check ✅ Passed The description covers the required template sections with specific technical details about changes to test files and documentation, along with clear validation steps.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/coverage-over-80-refresh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35b317b1b3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread website/src/DocsApp.jsx Outdated
Comment on lines +721 to +723
image: ghcr.io/fernandotonon/qtmesh:latest
script:
- scan \${CI_PROJECT_DIR}/assets \\
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Override entrypoint in GitLab CI example

This snippet is likely to fail when copied into real GitLab pipelines because our container sets ENTRYPOINT ["docker-entrypoint.sh"] and that entrypoint only recognizes qtmesh subcommands as argv[1]; GitLab Docker executor starts jobs by passing sh/bash as the command, so the entrypoint falls through and runs qtmesheditor --cli sh ... instead of the scan command. In practice that exits as an unknown subcommand before scanning, so the docs should show an entrypoint: [""] override (or wrap with docker run) for a working job.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9cfc829.

Updated the GitLab CI example to include entrypoint: [""], so the job command runs correctly with GitLab Docker executor semantics.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 612cd30.

Updated the GitLab CI snippet to run explicit CLI mode under entrypoint: [""]:

  • qtmesheditor --cli scan ...
  • also pinned the image to ghcr.io/fernandotonon/qtmesh:2.23.0.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/CLIPipeline_test.cpp`:
- Around line 1776-1780: The test TEST(CLIPipelineCmdScanError,
MissingConfigFileReturns2) currently uses a fixed path that may exist on some
runners; modify the test to generate a unique, guaranteed-nonexistent config
path at runtime (e.g., build a path from std::filesystem::temp_directory_path()
plus a unique token or use a secure temp-name generator) before constructing
TestArgv and calling CLIPipeline::cmdScan, and assert the file does not exist
prior to invoking cmdScan so the test is deterministic across
Windows/Linux/macOS.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ae3ac3f-7064-430e-ab22-f882739c3e51

📥 Commits

Reviewing files that changed from the base of the PR and between 5168562 and 35b317b.

📒 Files selected for processing (3)
  • src/CLIPipeline_test.cpp
  • src/mainwindow_test.cpp
  • website/src/DocsApp.jsx

Comment thread src/CLIPipeline_test.cpp
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
website/src/DocsApp.jsx (1)

687-687: Pin CI example references instead of floating refs.

Using @master and :latest in docs weakens reproducibility and supply-chain safety for users copying these CI snippets. Prefer a release tag or immutable digest/SHA.

Proposed doc adjustment
-- uses: fernandotonon/QtMeshEditor/.github/actions/qtmesh@master
+- uses: fernandotonon/QtMeshEditor/.github/actions/qtmesh@<pinned-tag-or-commit-sha>

-  image: ghcr.io/fernandotonon/qtmesh:latest
+  image: ghcr.io/fernandotonon/qtmesh@sha256:<pinned-digest>

Also applies to: 721-721

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@website/src/DocsApp.jsx` at line 687, The docs include an Action reference
pinned to a floating ref (CodeBlock showing
"fernandotonon/QtMeshEditor/.github/actions/qtmesh@master"); update that string
inside the CodeBlock component (and the other occurrence at the same snippet) to
use an immutable tag or commit SHA (e.g., `@vX.Y.Z` or @<commit-sha>) instead of
`@master/`@latest so CI examples are reproducible and supply-chain safe.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@website/src/DocsApp.jsx`:
- Around line 722-728: The CI example currently overrides the container startup
with entrypoint: [""] which bypasses the image's entrypoint logic that normally
adds --cli, so update the script invocation under the script: block to call the
scanner binary in explicit CLI mode by adding the --cli flag before the target
path (i.e., ensure the scan command includes --cli) or, alternatively, remove
the entrypoint: [""] override so the image's launcher supplies --cli; adjust the
entrypoint/script accordingly to guarantee the scanner runs with CLI mode.

---

Nitpick comments:
In `@website/src/DocsApp.jsx`:
- Line 687: The docs include an Action reference pinned to a floating ref
(CodeBlock showing "fernandotonon/QtMeshEditor/.github/actions/qtmesh@master");
update that string inside the CodeBlock component (and the other occurrence at
the same snippet) to use an immutable tag or commit SHA (e.g., `@vX.Y.Z` or
@<commit-sha>) instead of `@master/`@latest so CI examples are reproducible and
supply-chain safe.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ddb00bd2-b978-483a-88ea-43374bb05407

📥 Commits

Reviewing files that changed from the base of the PR and between 35b317b and 9cfc829.

📒 Files selected for processing (2)
  • src/CLIPipeline_test.cpp
  • website/src/DocsApp.jsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/CLIPipeline_test.cpp

Comment thread website/src/DocsApp.jsx
Copy link
Copy Markdown
Owner Author

Addressed the remaining review note in 612cd30.

Changes in docs CI snippets:

  • pinned GitHub Action reference to commit SHA (.../qtmesh@9cfc829e8b255994ef92ba228c687e3dd2254119)
  • pinned GitLab image tag to ghcr.io/fernandotonon/qtmesh:2.23.0
  • adjusted GitLab script invocation to explicit CLI mode with qtmesheditor --cli scan ... when using entrypoint: [""]

Also verified website build locally (npm run build).

@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant