/codacy-skills:setup-coveragefrom codacy-skills
Detects testing frameworks and CI/CD pipelines, then configures coverage generation and upload to Codacy. Use when setting up coverage, fixing missing uploads, or troubleshooting Codacy coverage gaps.
Ships in codacy-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Glossary: See glossary.md for shared definitions of Codacy concepts (issues, findings, severity, coverage, tools, patterns, etc.).
This skill sets up test coverage reporting in a repository and configures automatic upload to Codacy. It detects what exists, identifies what is missing, and fills the gaps.
CODACY_PROJECT_TOKEN or CODACY_API_TOKEN must be available for coverage uploads (see Authentication)Coverage Setup Progress:
- [ ] Step 1: Detect testing setup
- [ ] Step 2: Detect CI/CD pipeline
- [ ] Step 3: Identify coverage gaps
- [ ] Step 4: Add coverage generation
- [ ] Step 5: Add Codacy coverage upload
- [ ] Step 6: Verify the setup
Scan the repository to identify:
createDebugCoverageReportgo testcollectCoverage, pytest.ini coverage settings, JaCoCo plugin in pom.xml/build.gradle, etc.)coverage/, lcov.info, cobertura.xml, jacoco*.xml, etc.)Report findings to the user before proceeding.
Identify which CI/CD system is in use:
| CI/CD | Detection files |
|---|---|
| GitHub Actions | .github/workflows/*.yml |
| GitLab CI | .gitlab-ci.yml |
| CircleCI | .circleci/config.yml |
| Travis CI | .travis.yml |
| Bitbucket Pipelines | bitbucket-pipelines.yml |
| Jenkins | Jenkinsfile |
| Azure DevOps | azure-pipelines.yml |
Read the CI config to understand:
Based on steps 1 and 2, determine what is missing:
Present the gap analysis to the user and confirm the plan before making changes.
Add the minimal configuration to generate coverage reports in a format Codacy supports. Choose the format based on the language and tooling. See references/coverage-formats.md for the full format reference.
JavaScript/TypeScript (Jest):
// In package.json or jest.config.js
{
"collectCoverage": true,
"coverageReporters": ["lcov"]
}
Or run: npx jest --coverage --coverageReporters=lcov
JavaScript/TypeScript (Vitest):
// vitest.config.ts
{ test: { coverage: { reporter: ['lcov'] } } }
Python (pytest + coverage.py):
pip install pytest-cov
pytest --cov --cov-report=xml:cobertura.xml
Java (Maven + JaCoCo):
Add the JaCoCo Maven plugin to pom.xml:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<goals><goal>prepare-agent</goal></goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals><goal>report</goal></goals>
</execution>
</executions>
</plugin>
Java (Gradle + JaCoCo):
plugins { id 'jacoco' }
jacocoTestReport { dependsOn test }
Run: ./gradlew test jacocoTestReport
Kotlin (Gradle + JaCoCo):
plugins { id 'jacoco' }
jacocoTestReport {
dependsOn test
reports { xml.required = true }
}
Run: ./gradlew test jacocoTestReport
Report location: build/reports/jacoco/test/jacocoTestReport.xml
Kotlin (Maven + JaCoCo): Same as Java Maven + JaCoCo setup above — JaCoCo supports Kotlin bytecode natively.
Android (Gradle + JaCoCo):
android {
buildTypes {
debug { testCoverageEnabled true }
}
}
Run: ./gradlew createDebugCoverageReport
Report location: app/build/reports/coverage/debug/report.xml
For multi-module Android projects, use a merged report or partial uploads (see references/coverage-upload.md).
Go:
go test -coverprofile=coverage.out ./...
Ruby (SimpleCov):
# At the top of spec/spec_helper.rb or test/test_helper.rb
require 'simplecov'
SimpleCov.start
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
Requires simplecov and simplecov-cobertura gems.
C#/.NET (Coverlet):
dotnet test --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura
Scala (sbt-jacoco):
Add to project/plugins.sbt:
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.5.0")
Run: sbt jacoco
PHP (PHPUnit):
phpunit --coverage-clover clover.xml
Add a coverage upload step to the CI/CD pipeline after the test/coverage step.
The upload requires one of:
Option A — Repository token (single repo, simpler):
CODACY_PROJECT_TOKEN as a CI/CD secretOption B — Account token (multiple repos):
CODACY_API_TOKEN — from Codacy > My Account > Access ManagementCODACY_ORGANIZATION_PROVIDER — gh, gl, or bbCODACY_USERNAME — organization or usernameCODACY_PROJECT_NAME — repository nameAlways remind the user to add the appropriate token as a CI/CD secret.
The standard upload command:
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r <coverage-report-file>
For Go coverage, add the parser flag:
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
--force-coverage-parser go -r coverage.out
For multiple reports (e.g., monorepos or multi-module projects):
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
-r report1.xml -r report2.xml
Or use partial uploads:
bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -r report1.xml
bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -r report2.xml
bash <(curl -Ls https://coverage.codacy.com/get.sh) final
GitHub Actions:
- name: Upload coverage to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r <report-file>
Or use the official action:
- name: Upload coverage to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: <report-file>
GitLab CI:
upload-coverage:
stage: test
script:
- bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r <report-file>
variables:
CODACY_PROJECT_TOKEN: $CODACY_PROJECT_TOKEN
CircleCI (using orb):
orbs:
codacy: codacy/coverage-reporter@13
workflows:
main:
jobs:
- test
- codacy/upload_coverage:
requires: [test]
Travis CI:
after_success:
- bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r <report-file>
Bitbucket Pipelines:
- step:
name: Upload coverage
script:
- bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r <report-file>
Alpine Linux (no bash):
wget -qO - https://coverage.codacy.com/get.sh | sh -s -- report -r <report-file>
See references/coverage-upload.md for advanced upload scenarios.
After making changes:
CODACY_PROJECT_TOKEN (or account token variables) as a CI/CD secretAfter pushing, verify:
- [ ] CI pipeline passes (tests run, coverage report generated)
- [ ] Coverage upload step succeeds (no errors in CI logs)
- [ ] Codacy shows coverage data for the commit
Common issues and their solutions:
| Status | Cause | Fix |
|---|---|---|
| Commit Not Found | Webhook not received or wrong commit SHA | Wait 5-10 min; verify the commit SHA matches |
| Pending | File paths in report don't match repo structure | Ensure paths are relative to repo root (e.g., src/index.js, not /home/ci/project/src/index.js) |
| Final Report Not Sent | Used --partial without final | Add bash <(curl -Ls https://coverage.codacy.com/get.sh) final after all partial uploads |
| Branch Not Enabled | Coverage uploaded for unanalyzed branch | Enable the branch in Codacy repository settings |
| No coverage shown on PRs | Missing coverage for common ancestor commit | Ensure coverage runs on all branches, not just PRs |
-l <Language> flags or partial uploads with language specificationWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub codacy/codacy-skills --plugin codacy-skills6 skills in this plugin
/codacy-analysis-cliUses the Codacy Analysis CLI to run local static analysis on repositories or specific files. Handles installation, initialization, dependency management, dry-runs, and analysis with JSON output. Use whenever the user wants to analyze code locally, run static analysis, scan for bugs or security issues, lint files, check code quality without pushing to Codacy, or run tools like ESLint, Ruff, Semgrep, RuboCop, or any other supported analyzer on their machine. Also trigger when the user asks to analyze staged changes, scan a PR locally, or set up local Codacy analysis./codacy-cloud-cliUses the Codacy Cloud CLI to query repositories, issues, security findings, pull requests, tools, and patterns on Codacy Cloud. Use whenever the user mentions Codacy, asks about code quality metrics, wants to check issues or findings in a repo, inspect a pull request analysis, browse security vulnerabilities, enable or disable tools, search patterns, trigger a reanalysis, or interact with any remote Codacy data — even if they don't say "Codacy CLI" explicitly./codacy-code-reviewEnriches pull request code reviews with Codacy data — quality issues, security findings, coverage, and duplication. Use whenever the user asks to review a PR, check what a pull request introduced, verify PR coverage, look at PR quality, or find new issues in a PR. Also use when another code-review skill is active (e.g. CodeRabbit) to layer Codacy data on top. Trigger this skill for any pull request review workflow, even if the user just says "review PR 42" or "what's wrong with this PR"./configure-codacyTailors Codacy configuration to a project by discovering its stack, enabling the right tools and patterns, running analysis, and intelligently reducing noise — disabling irrelevant or noisy patterns, tuning thresholds, and excluding files that shouldn't be analyzed. Produces a machine-readable summary of all changes. Use whenever the user wants to configure Codacy, reduce noise, fix false positives, enable or disable tools or patterns, tune code quality rules, deal with too many warnings, or align Codacy with their project's conventions. Also trigger when the user complains about irrelevant issues, noisy linters, or wants to set up Codacy for the first time on a repo./configure-codacy-cloudTunes an existing Codacy Cloud repository's configuration directly on the cloud, without local analysis, by importing the current config, suggesting higher-signal tools and patterns, reanalyzing, and iteratively reducing noise across two tuning passes. Requires the repository to already be on Codacy with at least one finished analysis. Uses the Codacy Analysis CLI only for config-file operations and the Codacy Cloud CLI for everything else. Produces a machine-readable JSON summary of pattern, tool, category, and severity changes plus conflicts and recommended path ignores. Use when the user wants to configure or tune Codacy directly on the cloud, reduce noise on a repository already analyzed by Codacy, optimize cloud patterns and tools, or improve the signal of cloud issues without running local analysis.Other plugins' skills for the same job