For the complete documentation index, see llms.txt. This page is also available as Markdown.

Rust

Language-specific information about the way that SonarQube Cloud supports the analysis of Rust.

Supported versions

The level of support for a language is defined as follows:

  • Fully supported: Analysis will complete. All the language features are understood and examined.

  • Supported: Most language features are understood and examined but the version includes unsupported features. Analysis might break or provide incomplete results.

All Rust versions are fully supported.

The Rust analyzer supports:

  • Code Coverage import (LCOV and Cobertura formats)

  • Cognitive Complexity metric

  • Cyclomatic Complexity metric

  • Import of Clippy output as external rules (JSON format)

Prerequisites

Before using the Sonar Rust analyzer, ensure the following tools are installed and available in your system’s PATH:

  • Cargo: The Rust package manager. You can install it from rustup.rs.

Running the analysis

You can analyze Rust projects using the SonarScanner for Cargo, a Cargo subcommand that runs the analysis with a single command, or the SonarScanner CLI. Make sure the scanner you choose is available on the machine running the analysis.

Clippy integration

The Sonar Rust analyzer can import issues from Clippy, the Rust linter, alongside its own findings. The analyzer does not run Clippy for you: generate the report yourself, then point the analyzer at it with sonar.rust.clippyReport.reportPaths, which accepts a comma-separated list of file paths.

See External analyzer reports for setup instructions.

Importing Clippy reports is optional. All other Sonar Rust analysis features, such as code metrics calculation, code complexity, and code duplication, are unaffected by whether you import them.

Code coverage

See the Test coverage parameters page for information on importing coverage reports for Rust.

Language-specific properties

For a complete list of available properties and their descriptions, please refer to the Rust-specific properties in Your project > Administration > Configuration > General Settings > Languages > Rust.

To discover and update the Rust-specific properties, navigate in SonarQube Cloud to Your Project > Administration > General Settings > Languages > Rust. See Configuration overview for more information about setting properties.

Troubleshooting

If a Clippy report fails to import, a warning is displayed in the logs and on the project page. Check that the path in sonar.rust.clippyReport.reportPaths resolves, and that the report was produced with --message-format=json.

Last updated

Was this helpful?