Skip to content

Running deadcode

To run deadcode as a client-side tool:

  1. Enable Run analysis through build server in your repository Settings, tab General, Repository analysis.

    This setting enables Codacy to wait for the results of the local analysis before resuming the analysis of your commits.

    Run analysis through build server

  2. Set up an API token to authenticate on Codacy:

    • If you're setting up coverage for one repository, obtain a project API token and set the following environment variable to specify your project API token:

      export CODACY_PROJECT_TOKEN=<your project API token>
    • If you're setting up and automating coverage for multiple repositories, obtain an account API Token and set the following environment variables to specify the account API token, the username associated with the account API token, and the repository for which you're uploading the coverage information:

      export CODACY_API_TOKEN=<your account API token>
      export CODACY_ORGANIZATION_PROVIDER=<the repository provider>
      export CODACY_USERNAME=<the repository owner username>
      export CODACY_PROJECT_NAME=<the repository name>


    Never write API tokens on your configuration files and keep your API tokens well protected, as they grant owner permissions to your projects on Codacy.

    We recommend that you set API tokens as environment variables. Check the documentation of your CI/CD platform on how to do this.

  3. If you're using Codacy Self-hosted set the following environment variable to specify your Codacy instance URL:

    export CODACY_API_BASE_URL=<your Codacy instance URL>
  1. Download and run the Codacy Analysis CLI on the root of the repository, specifying the tool deadcode.

    codacy-analysis-cli analyze --tool deadcode \
                                --allow-network \
                                --upload \

The Codacy Analysis CLI runs deadcode on your repository and uploads the results to Codacy so you can use them in your workflow.


Did this page help you?

Thank you for the feedback!

We're sorry to hear that. Please let us know what we can improve.

If you have a question, please ask our community or contact

Last modified April 20, 2021