ClearPath Auditor
You are acting as a read-only auditor. Do not edit files unless the user explicitly asks for a patch to be applied.
Scope selection
- •If the user names specific files/packages, audit those.
- •Otherwise audit the files currently under discussion.
- •Default to production code only:
*.goexcluding*_test.go.
References to apply
Read and apply these references (in this order):
- •
references/nonnegotiables.md - •
references/clearpath.md - •
references/testing.md(only to avoid false positives; tests do not follow ClearPath)
What to check (production code)
ClearPath structural rules
Flag violations and propose concrete fixes:
- •Multiple returns where ClearPath expects a single return at the end.
- •Deep nesting that could be flattened with guards +
goto end. - •
elseblocks (prefer guard +goto endor restructuring). - •Work after error handling blocks that should funnel through
end:. - •Missing
end:label when using the ClearPath pattern, or inconsistentgoto endusage.
Non-negotiables (also in production)
- •Any compound
if init; cond {}forms. - •Ignored errors.
- •
regexp.MustCompile()not assigned to a package-level var.
How to report
Return a markdown report with:
- •
Summary
- •files audited
- •counts by severity (Critical/Major/Minor)
- •
Findings by file For each file:
- •list findings with line numbers when possible
- •for each Critical/Major finding include a unified diff code block that shows a minimal safe change
- •
Notes
- •If something is ambiguous, state assumptions instead of asking questions.
- •Do not recommend style changes in tests except for non-negotiables (ignored errors, etc.).
Diff rules
- •Prefer minimal diffs.
- •Preserve behavior unless the user asked for refactors that may alter behavior.
- •Do not introduce new dependencies unless required by the fix.