{"id":28495951,"url":"https://github.com/sonarsource/sonar-rust","last_synced_at":"2025-12-02T18:03:20.203Z","repository":{"id":286820311,"uuid":"926551246","full_name":"SonarSource/sonar-rust","owner":"SonarSource","description":"Plugin for Rust language","archived":false,"fork":false,"pushed_at":"2025-08-19T07:38:52.000Z","size":454,"stargazers_count":34,"open_issues_count":0,"forks_count":0,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-08-19T09:54:09.089Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SonarSource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-03T13:09:38.000Z","updated_at":"2025-08-19T07:38:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"579e0891-5776-4598-a71d-6c9c83956d50","html_url":"https://github.com/SonarSource/sonar-rust","commit_stats":null,"previous_names":["sonarsource/sonar-rust"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/SonarSource/sonar-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonarSource%2Fsonar-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonarSource%2Fsonar-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonarSource%2Fsonar-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonarSource%2Fsonar-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SonarSource","download_url":"https://codeload.github.com/SonarSource/sonar-rust/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonarSource%2Fsonar-rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273082419,"owners_count":25042282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-08T11:38:13.752Z","updated_at":"2025-12-02T18:03:15.167Z","avatar_url":"https://github.com/SonarSource.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Code Quality for Rust\n\n[![Quality Gate Status](https://next.sonarqube.com/sonarqube/api/project_badges/measure?project=SonarSource_sonar-rust\u0026metric=alert_status\u0026token=sqb_a062f88ef3aa92cecf9d7a288859fd120a839d0c)](https://next.sonarqube.com/sonarqube/dashboard?id=SonarSource_sonar-rust) [![Coverage](https://next.sonarqube.com/sonarqube/api/project_badges/measure?project=SonarSource_sonar-rust\u0026metric=coverage\u0026token=sqb_a062f88ef3aa92cecf9d7a288859fd120a839d0c)](https://next.sonarqube.com/sonarqube/dashboard?id=SonarSource_sonar-rust)\n\nThis SonarSource project is a code analyzer for Rust projects to help developers write [Clean Code](https://www.sonarsource.com/solutions/clean-code).\n\n## Features\n\n- 80+ rules\n- Metrics (cognitive complexity, cyclomatic complexity, number of lines, etc.)\n- Import of [test coverage reports](https://docs.sonarsource.com/sonarqube-cloud/enriching/test-coverage/overview/)\n- Import of [external Clippy reports](https://docs.sonarsource.com/sonarqube-cloud/enriching/external-analyzer-reports/)\n\n## Feedback\n\nWe welcome your feedback and feature requests to help improve the Rust analyzer. To share your thoughts or request new features, please visit the [Sonar Community Forum](https://community.sonarsource.com/). \n\n## Building the Project\n\n### Requirements\n\nTo work on this project, you will need the following tools:\n\n- Java 17\n- Rust 2021\n- Gradle\n- Cargo\n\n### Build\n\nTo build the project, you can use the following Gradle commands:\n\n- `./gradlew tasks`: Lists all the available tasks in the project.\n- `./gradlew build`: Compiles the code and runs all tests.\n- `./gradlew shadowJar`: Creates a fat JAR file that includes all dependencies.\n- `./gradlew spotlessApply`: Formats the code according to the project's style guidelines.\n\n#### Cross-Compilation\n\nThe project includes a native Rust analyzer that needs to be cross-compiled for different platforms. To cross-compile the Rust analyzer, \nyou need to install cross-compilers and Rust toolchains for the target platforms. Below are the instructions for installing the \ncross-compilers for different platforms:\n\n##### Mac OS X\n\n```shell\nbrew install SergioBenitez/osxct/x86_64-unknown-linux-gnu\nbrew install filosottile/musl-cross/musl-cross\nbrew install mingw-w64\n```\n\n##### Ubuntu\n\n```shell\napt-get -y install rustup gcc-mingw-w64 musl-tools musl-dev build-essential autoconf libtool pkg-config\n```\n\n##### Rust Toolchains\n\nYou also need to install the Rust toolchains for the target platforms:\n\n```shell\nrustup target add x86_64-pc-windows-gnu\nrustup target add x86_64-unknown-linux-musl\nrustup target add x86_64-unknown-linux-gnu\nrustup target add aarch64-unknown-linux-musl\nrustup target add x86_64-apple-darwin\n```\n\nTo verify installed toolchains, you can run the following command:\n\n```shell\nrustup target list\n```\n\n### Running End-to-End Tests\n\nEnd-to-end tests verify the entire system from start to finish. These tests involve starting a SonarQube instance, invoking the scanner as a user would, running the sensor, sending issues to the Plugin API, processing them using the SonarQube instance, and finally comparing the outcome to the expected behavior.\n\nTo run the end-to-end tests, use the following command:\n\n```\n./gradlew :e2e:test -Pe2e\n```\n\nIt executes the end-to-end tests, ensuring that the entire system works as expected.\n\n# License\n\nCopyright 2025 SonarSource.\n\nSonarQube analyzers released after November 29, 2024, including patch fixes for prior versions,\nare published under the [Sonar Source-Available License Version 1 (SSALv1)](LICENSE).\n\nSee individual files for details that specify the license applicable to each file.\nFiles subject to the SSALv1 will be noted in their headers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonarsource%2Fsonar-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonarsource%2Fsonar-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonarsource%2Fsonar-rust/lists"}