Print config directories in -hc and verbose modes - #7578
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughCentralizes config, cache, and PDCP directory reporting, then exposes it in version output, health checks, and verbose or very verbose startup logs. Tests verify the shared formatting. ChangesDirectory diagnostics
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant NucleiCLI
participant runner.New
participant DoHealthCheck
participant DirectoryHelpers
NucleiCLI->>runner.New: start with verbose flags
runner.New->>DirectoryHelpers: LogDirectoryInfo(logger)
NucleiCLI->>DoHealthCheck: run health check
DoHealthCheck->>DirectoryHelpers: AppendDirectoryInfo(writer)
NucleiCLI->>DirectoryHelpers: printVersion
DirectoryHelpers-->>NucleiCLI: formatted directory paths
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/runner/directories_test.go (1)
10-15: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the reported directory values, not only their labels.
This test would pass if the helper printed incorrect paths while retaining the expected labels. Compare against
GetConfigDir(),GetCacheDir(), andpdcpauth.PDCPDir, or assert the complete formatted string.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/runner/directories_test.go` around lines 10 - 15, Update TestDirectoryInfoContainsKnownLabels to validate the directory values as well as their labels by comparing DirectoryInfo() with GetConfigDir(), GetCacheDir(), and pdcpauth.PDCPDir, or by asserting the complete expected formatted output while preserving the existing newline-count check.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/runner/directories_test.go`:
- Line 19: Update the test around DoHealthCheck to avoid invoking its live
network probe; extract the health-check result formatting path or inject a
mockable dialer, then test that isolated behavior with deterministic inputs.
Ensure the test no longer dials scanme.sh or depends on network availability.
---
Nitpick comments:
In `@internal/runner/directories_test.go`:
- Around line 10-15: Update TestDirectoryInfoContainsKnownLabels to validate the
directory values as well as their labels by comparing DirectoryInfo() with
GetConfigDir(), GetCacheDir(), and pdcpauth.PDCPDir, or by asserting the
complete expected formatted output while preserving the existing newline-count
check.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 483c20b1-0559-44f6-a6bf-814b6e636fed
📒 Files selected for processing (5)
cmd/nuclei/main.gointernal/runner/directories.gointernal/runner/directories_test.gointernal/runner/healthcheck.gointernal/runner/runner.go
| } | ||
|
|
||
| func TestDoHealthCheckIncludesDirectoryInfo(t *testing.T) { | ||
| out := DoHealthCheck(nil) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Keep this test independent of live network probes.
DoHealthCheck(nil) also dials scanme.sh without timeouts, so this unit test can hang or fail when CI lacks network access. Extract the formatting path or inject a mockable dialer instead of invoking the full health check here.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/runner/directories_test.go` at line 19, Update the test around
DoHealthCheck to avoid invoking its live network probe; extract the health-check
result formatting path or inject a mockable dialer, then test that isolated
behavior with deterministic inputs. Ensure the test no longer dials scanme.sh or
depends on network availability.
7f059a3 to
070d622
Compare
Summary
Summary by CodeRabbit