docs: add Codacy Analysis CLI page under Codacy CLIs - #2749
Conversation
Adds a reference page for @codacy/analysis-cli (the codacy-analysis command), which had no page of its own — its install and init steps lived inside the Codacy Guardrails getting-started page, and other pages linked to that anchor. Every command, flag, and environment variable on the page is checked against CLI 0.23.0 (codacy-analysis <command> --help, codacy-analysis info, and the README from the package tarball). Behaviors that neither the help output nor the README states correctly were verified by running the CLI: - exit codes are 0 no issues / 1 issues found / 2 invalid flag combination; an unavailable tool, even with --fail-if-missing, still exits 0, so --fail-if-missing does not fail a CI job - --inspect, --install-dependencies and --fail-if-missing are a three-way mutual exclusion, not two-way - analyze reads the excludes recorded in codacy.config.json, never .codacy.yaml directly, so editing that file changes nothing until init or update-config runs - config --merge keeps the destination's metadata.source, so merging a --remote config into an --auto one stays incremental under update-config The page links the npm package rather than the source repository, which is private. Repoints the references that pointed at the Guardrails anchor or at npm, and cross-links the Codacy Cloud CLI and Codacy Skills pages. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Pull Request Overview
The CI example should not be merged as written because it uses an undocumented CODACY_PROJECT_TOKEN variable without passing --repository-token, which may cause authentication failures for init --remote and upload. Codacy reports the PR as up to standards, with no quality issues detected.
About this PR
- The documented CLI behaviors are not covered by automated tests or reproducible validation fixtures, leaving authentication and edge-case documentation vulnerable to regression.
Test suggestions
- Validate that the new CLI page is registered in navigation and all intended cross-links resolve.
- Verify the documented installation, authentication, and environment-variable instructions.
- Verify init modes and the
--staged/--diff/--prmutual exclusions. - Verify analyze exit codes and the three-way conflict among
--inspect,--install-dependencies, and--fail-if-missing. - Verify
exclude_pathsare consumed fromcodacy.config.jsonand require init or update-config after source changes. - Verify
config --mergepreserves destinationmetadata.sourceand remains compatible with incremental update-config. - Verify the CI workflow uses a token variable and upload invocation accepted by the Analysis CLI.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Validate that the new CLI page is registered in navigation and all intended cross-links resolve.
2. Verify the documented installation, authentication, and environment-variable instructions.
3. Verify init modes and the `--staged`/`--diff`/`--pr` mutual exclusions.
4. Verify analyze exit codes and the three-way conflict among `--inspect`, `--install-dependencies`, and `--fail-if-missing`.
5. Verify `exclude_paths` are consumed from `codacy.config.json` and require init or update-config after source changes.
6. Verify `config --merge` preserves destination `metadata.source` and remains compatible with incremental update-config.
7. Verify the CI workflow uses a token variable and upload invocation accepted by the Analysis CLI.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
…ands The page had 13 top-level sections ranging from 4 to 90 lines, so the "On this page" nav read as a flat list of equal-looking entries for things that were not equal. The sibling Codacy Cloud CLI page has 6, nesting its capabilities as ### under one ##. Three changes: - Requirements now carries the path to a first analysis, branching on whether the repository is on Codacy. That question was previously answered in section 10 of 13, after nine sections of reference. - init modes are led by a recommendation instead of presented as a flat five-way menu with no default: init --remote when the repository is on Codacy, init --auto when it is not, with the two narrower modes after them. - Common workflows keeps only the recipes that compose commands the body cannot show on their own: the --auto plus Codacy Cloud merge, and CI. The other three restated the command sections and are gone, absorbed into Requirements and Scope the analysis. Also merges Inspect your stack with Combine configuration files, and Codacy Self-hosted with Run behind a proxy. No content dropped: every command, environment variable, and verified behavior from the previous revision is still present, and all five explicit anchors are unchanged, including the #authentication one that docs/codacy-skills/index.md links to. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Restructured in 2053d39 after review feedback that the section layout was incoherent — it was a command-by-command body with a 13 top-level sections → 10. The old ones ranged from 4 to 90 lines, so the "On this page" nav was a flat list of equal-looking entries for things that were not equal. For comparison, the sibling Codacy Cloud CLI page has 6 and nests its capabilities as What changed:
Nothing was dropped and no new claims were introduced: every command, environment variable, and verified behavior from the first commit is still on the page, checked by diffing the command and term sets between revisions. All five explicit anchors are unchanged, including
|
Brings in #2747 (link each Codacy skill to its SKILL.md) and #2748 (update the Guardrails built-in scanner lists). One conflict, in docs/codacy-skills/index.md. #2747 removed the "Needs" column from the Available skills table and moved the per-skill CLI requirement into a sentence under Requirements, which is the column this branch had added the two CLI page links to. Resolved by taking that commit's table as-is and moving the links to the sentence the information moved to, so both changes survive: the skill names link to their SKILL.md, and the two CLI names link to their documentation. docs/codacy-guardrails/codacy-guardrails-getting-started.md merged without conflict — #2748 rewrote the scanner lists above the two lines this branch changed. Verified the merged file is that commit's version plus only those two link edits, with all 30 scanner entries intact. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Overall readability score: 54.01 (🟢 +0.05)
View detailed metrics🟢 - Shows an increase in readability
Averages:
View metric targets
|
The tip closed the Upload results to Codacy section, where it read as a footnote to the account-token example rather than as a setting anyone needs to touch. It belongs with the pipeline that does the uploading, so it now sits directly under the workflow snippet in Use the CLI in CI. Reworded "these results" to "the uploaded results", since the pronoun no longer has the upload commands immediately above it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
What
Adds a reference page for the Codacy Analysis CLI (
@codacy/analysis-cli, thecodacy-analysiscommand) atdocs/codacy-analysis-cli/index.md, registered in the nav under Codacy CLIs beside the Codacy Cloud CLI.The CLI had no page of its own. Its install and
initsteps lived inside the Codacy Guardrails getting-started page, and five other pages linked to that anchor (#install-cli) or to npm. This gives it a home and repoints those references.Why the page says what it says
Every command, flag, and environment variable is checked against CLI 0.23.0 —
codacy-analysis <command> --help,codacy-analysis info, and the README from the package tarball (the npm web page carries none). Four behaviors that neither the help output nor the README states correctly were found by running the CLI, and the page documents the verified behavior:0no issues,1issues found,2invalid flag combination. There is no "execution error" code: an unavailable tool, even with--fail-if-missing, still exits0— so--fail-if-missingdoes not fail a CI job.--inspect/--install-dependencies--fail-if-missing. The README documents only the two-way conflict.exclude_pathsanalyzereads theexcludelist recorded incodacy.config.json, never.codacy.yamldirectly. Editing.codacy.yamlchanges nothing untilinitorupdate-configruns (2 issues → 1 issue only afterupdate-config).config --mergemetadata.source, so merging a--remoteconfig into an--autoone stayssource: autoandupdate-configremains incremental afterwards (tools +0/-0).Also verified rather than assumed: Node.js ≥ 20; every environment variable named on the page exists in the package;
initwritescodacy.config.baseline.jsonand a.codacy/.gitignore;initmodes and the--staged/--diff/--prflags are mutually exclusive; a git flag combined with--filesis an intersection; tool IDsPyLintPython3,Semgrep(Opengrep),ESLint9; SARIF output is real SARIF; and the shared-credentials claim (the Cloud CLI authenticated with no token on the command line and none in the environment, reading the same~/.codacy/credentials).Not exercised, and resting on
--helpplus the README, which agree:uploadandinit --remoteagainst a live repository token.Highlighted workflow
A Common workflows section leads with combining
init --autowith the repository's Codacy Cloud config, since neither set contains the other:--intersectis presented as the same move in reverse, for when a merge surfaces more than you want to act on. The measured pattern counts are deliberately not baked into the page — that config changes — so it shows the CLI's own output line instead.Deliberate choices
codacy/analysis-cliis private and would 404 for readers.PyLintPython3,Semgrep) and points atcodacy-analysis info; a 30-row inventory would rot.## Use the CLI in CIstays top-level rather than nesting under Common workflows, so it keeps its place in the "On this page" nav (toc_depth: 2).Left alone
Three pages say "Codacy Analysis CLI" but mean the legacy
codacy-analysis-cli(the Scala/Docker tool). Repointing them would change a factual claim, not a link, so they're untouched and worth a separate pass:docs/repositories-configure/codacy-configuration-file.md:75—validate-configuration, a command the new CLI does not havedocs/faq/troubleshooting/why-is-my-file-over-150-kb-missing.md:13docs/faq/troubleshooting/why-arent-duplication-metrics-being-calculated.md:33Verification
mkdocs build --strictpasses apart from one expected warning:git-revision-date-localizedhas no git log for the new file, which resolves once this is merged. Anchors are validated (validation.anchors: warn), so the internal cross-links resolve.nav:entry checked by hand. No redirect needed — the page is new, nothing moved.vale docs/codacy-analysis-cli/index.md— 10 advisory errors, all the same classes the existing Codacy Cloud CLI page produces: spaced em dashes (repo-wide convention),endrawfrom the Jinja block, lowercasecodacy/auto-andinside anchor ids, andmisconfiguredmissing from the vocabulary.🤖 Generated with Claude Code