Skip to content

tests: CLI commands and config.Load - #16

Merged
mrrobertkent merged 1 commit into
mainfrom
cli-tests
Oct 8, 2026
Merged

mrrobertkent merged 1 commit into
mainfrom
cli-tests

Conversation

@mrrobertkent

@mrrobertkent mrrobertkent commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Covers hookgate healthcheck (healthy, 503, unreachable), hookgate validate (valid, too-short and unset secret, secret never printed), version, an unknown command, and config.Load from a file and a missing file.

These paths had no tests, and the lines touched by the lint changes left SonarQube Cloud's new-code coverage at 72.7%, under the gate's 80%, which turned the quality-gate badge red.

Summary by CodeRabbit

  • Tests
    • Expanded command-line test coverage for health checks against successful, unavailable, and unreachable servers; validation of correctly sized, short, and empty secrets; and version output and unknown-command exit behavior.
    • Added checks that nonempty secrets are not printed and that configuration loading accepts a valid file and rejects a missing one.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: mrrobertkent/hookgate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3ec5b17e-c110-4fe7-9a05-1cfb632b22e4
📥 Commits

Reviewing files that changed from the base of the PR and between 1874402 and cd63436.

📒 Files selected for processing (2)
  • cmd/hookgate/main_test.go
  • internal/config/config_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Added tests for command exit codes and output, including secret non-disclosure. Added configuration loading tests for a valid file and a missing file.

Changes

Command and configuration test coverage

Layer / File(s) Summary
Command behavior tests
cmd/hookgate/main_test.go
Tests cover healthcheck and validate exit codes, validate secret non-disclosure, version output, and the exit code for an unknown command.
Configuration loading test
internal/config/config_test.go
Tests cover loading a valid configuration and returning an error for a missing file.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to cd634

The added tests do not change runtime behavior, and no issue requiring a fix before merging was identified.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the tested paths and coverage issue, but it does not use the required "What changes for users" and "Checklist" sections. It also omits the required checklist confirmations. Add the required headings and complete the checklist. State the user-facing change in one or two sentences, and confirm the test, lint, formatting, and documentation requirements.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: tests for CLI commands and config.Load.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟢 Low risk · The added CLI and config tests exercise existing behavior without changing executable code, so the PR has limited operational impact.

Adds tests for hookgate healthcheck (healthy, 503, and unreachable cases), hookgate validate (valid, too-short and unset secret, and confirms the secret is never printed), version, an unknown command, and config.Load from a file and a missing file. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@mrrobertkent
mrrobertkent merged commit 1ac44ac into main Oct 8, 2026
12 checks passed
@mrrobertkent
mrrobertkent deleted the cli-tests branch October 8, 2026 22:06
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