4.7. Setup Guide for External Analysis Tools¶
This guide describes how to run third-party analysis tools and import their findings into the Axivion Dashboard Server, so that the findings appear next to the results of the Axivion Suite. The imported findings are handled like style violations: they can be filtered, suppressed, and tracked over time.
4.7.1. Importers for known tools¶
The following rules run a specific tool, parse its report, and import the findings. They are located in the ImportThirdPartyAnalysisResults group. The group is not activated as a whole; activate the rules for the tools you use.
Rule |
Tool |
Notes |
|---|---|---|
Clippy (Rust) |
|
|
detekt (Kotlin) |
Runs |
|
ESLint (JavaScript, TypeScript) |
Prefers the |
|
knip (JavaScript, TypeScript) |
Requires knip 6.35 or later. |
|
PMD (Java) |
|
|
pylint (Python) |
||
pyright (Python) |
Pass the files or directories to check in |
|
qmllint (QML) |
|
|
Ruff (Python) |
||
SpotBugs (Java) |
Pass the class files in |
|
typos |
|
4.7.1.1. Setup¶
Install the tool on the machine that runs the analysis, or note the path to its executable.
Activate the rule for the tool in the ImportThirdPartyAnalysisResults group.
Optionally set
cwdto the directory in which the tool runs. If unset, the current working directory is used. Relative paths in the other options, and the file paths in the tool’s report, are interpreted relative to it.Set
executableif the tool is not onPATH.Set
config_fileif the rule offers it. The rule then passes the file to the tool and disables the tool’s own configuration lookup, so that the results do not depend on configuration files in the analyzed sources.Pass tool-specific arguments, such as the files to check, in
additional_args.
All these rules have the following options in common:
cwdThe directory in which the tool runs. If unset, the current working directory is used.
executableThe path to the tool’s executable. If unset, the tool is looked up on
PATH.config_fileThe tool’s configuration file, relative to
cwd.additional_argsAdditional arguments for the tool, passed on unquoted and unfiltered.
environmentAdditional environment variables for the tool.
check_returncodeWhether a non-zero exit status from the tool causes the rule to fail. Most linters exit with a non-zero status when they report findings, so the rules for such tools set this to false. A run that imports no findings while the tool exits non-zero always fails.
providerThe name under which the findings are shown in the Axivion Dashboard Server.
encodingandencoding_error_handlerThe encoding of the tool’s output and how to handle undecodable characters.
If you need to run a tool several times, for example for several projects, copy the rule in the configuration and give each copy its own options.
4.7.2. Importing reports of other tools¶
For tools without a dedicated rule, use one of the following rules.
- ImportSarifReport
Runs a tool that emits a SARIF 2.1.0 report and imports the report. The report is read from the tool’s standard output or from the file named by
report_location. Unlessprovideris set, the provider is the name of the tool used in each SARIF run.- ImportCheckstyleReport
Runs a tool that emits a Checkstyle-format XML report and imports the report.
report_locationandproviderwork as they do for ImportSarifReport. The provider defaults tocheckstyle.
Both rules take the executable and its arguments from executable and additional_args.
Pass the flags that instruct the tool to write the report in that format, for example
["--format", "checkstyle"].
- ImportExternalAnalysisOutput
Runs a command and matches its output line by line against regular expressions. The expressions are configured as formats in the ExternalAnalysisFormats group. Use this rule for tools that only print text.
Add a rule to ExternalAnalysisFormats and set its
provider. Its regular expression must define the named groups for the parts of a finding, for examplefilename,line,message, anderrno.Set
commandandoptionsof ImportExternalAnalysisOutput. Setexecute_as_shell_commandif the command requires a shell.Set
capture_stdout_providerandcapture_stderr_providerto the provider of the format that matches the respective output.Use
strip_path_prefixandprepend_path_prefixto turn the reported paths into paths relative to the project directory.
- Miscellaneous-ImportCSV
Imports findings from a CSV file that another process has already written. Set
filenameto the file and map its columns with thecolumn_*options.strip_prefixandprepend_prefixcanonicalize the file paths. This rule does not run a tool.- C#-ImportCompilerAndAnalyzerDiagnostics
Imports the warnings and errors of the C# compiler and Roslyn analyzers. See Source Code Analysis Setup Guide for C#/.NET.
4.7.3. Running the import¶
The importers run as part of the analysis, for example when you run axivion_ci.
They require no build step. If a tool is missing or fails without producing findings,
the rule fails instead of reporting that the tool found nothing.
Imported findings are suppressed and justified like other findings. See Exclude, Suppress and Justify Analysis Results for details.
4.7.4. References¶
Analysis Configuration Reference: Analysis Configuration Reference
Running Analyses with
axivion_ci: axivion_ci