You can get started with Coverity on Polaris command line scanning right away using the
following processes.
Scanning a project without configuring project settings
- In the Coverity on Polaris Web Interface, go to Downloads > Polaris CLI Tool. Download the Coverity on Polaris CLI tool for your OS. See Installing Command Line Tools on Coverity on Polaris.
- Unzip file or double-click the pkg file and follow insructions.
- Add the Coverity on Polaris executable to your path so you can execute it from anywhere
on the system. For example:
export PATH=/Users/UserName/Downloads/polaris_cli-macosx-1.7.83/bin:$PATH. - Navigate (change directory) to the directory containing the source code to be analyzed.
- Run the command
polaris analyze -wto analyze the entire directory. - Input your Coverity on Polaris URL and access token. You can generate an access token from within your Coverity on Polaris instance by clicking your user name in the top of the left navigation panel, and selecting Access Tokens > +Create New Token. See Generating an Access Token.
- When your scan is complete, copy and paste the URL at the end of your scan results into a browser address bar, and press Enter. This displays your scan results in Coverity on Polaris.
Scanning a project and configuring the Coverity on Polaris yml file with your project settings
- Follow steps 1 through 4 in the preceding section.
- Instead of running the analyze command in step 5, run the setup command
polaris setupto create a configuration .yml file in the scan directory. - Provide the URL for your Coverity on Polaris system.
- Provide the access token you created in the previous section. Or you can generate a new access token by clicking your user name in the top of the left navigation panel and selecting Access Tokens > +Create New Token.
- Optional: Navigate to your scan directory, and locate the file polaris.yml. Open the yml file in a text editor to edit the project name, specify the files to get picked up, and other project variables. After making your edits, save and close the file.
- Then run the analyze command:
polaris analyze -w. - When your scan is complete, copy and paste the URL at the end of your scan results into a browser address bar, and press Enter. This displays your scan results in Coverity on Polaris.
For more information
- You can override the .yml file using the command line. For more information, see Overriding the Configuration File from the Coverity on Polaris CLI.