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. Obtain a project API Token for your repository.

    You need the project API Token to allow the Codacy Analysis CLI to authenticate to Codacy when reporting the analysis results.

  3. Set the following environment variable to specify your project API Token:

    export CODACY_PROJECT_TOKEN=<your project API Token>
    

    Warning

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

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

  4. If you are using Codacy Self-hosted set the following environment variable to specify your Codacy instance URL:

    export CODACY_API_BASE_URL=<your Codacy instance URL>
    
  5. 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 \
                                --verbose
    

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

Feedback

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 contact support@codacy.com.

Last modified November 24, 2020