Codacy Enterprise supports pushing analysis results from your build server using the Codacy Analysis CLI.
Marking project as remote
A. Enable a specific project as remote
Go into the project, enter the settings and in section Project analysis enable Run analysis through build server.
B. Enable all projects as remote by default
Go to the admin panel, enter the settings tab and enable Run analysis for all projects through build server, by default.
Be sure to push results through the CLI after enabling any of this settings, otherwise the project affected will not trigger any analysis.
Setup the Codacy Analysis CLI
Follow the installation guide and get the codacy-analysis-cli executable running in your build server.
Run an analysis with the CLI
For now, the CLI still requires to retrieve the configuration in Codacy to perform an analysis.
For this reason, after you configure this to run you also need to give access to read the project configuration from Codacy.
The recommended way is to obtain a Project Token as explained in the CLI documentation.
You also have to configure the endpoint where Codacy enterprise is running either by using the
--codacy-api-base-url flag or the environment variable
After you have the token and the enterprise installation configured you can invoke the CLI as follows to get a report with all the issues.
codacy-analysis-cli analyse --directory <SOURCE-CODE-PATH> --project-token <PROJECT-TOKEN> --codacy-api-base-url <API-BASE-URL>
If you don't specify the tool, it will run as Codacy does in the backend, if you only want results for a specific one you can pass it with --tool.
Push Results to Codacy
If you want to push the results to Codacy, pass a flag --upload in the previous command too.
To configure some advanced details, check all the CLI flags in the CLI documentation.
Some flags you might be interested in are --allow-network - to run the tools that require compilation like FindBugs, --max-allowed-issues - to return a non-zero exit code when a certain number of issues is exceeded, --fail-if-incomplete - to return a non-zero exit code when any tool fails to run successfully.
If you run into any issues or have any questions, do not hesitate to send us an email at firstname.lastname@example.org.