Skip to content

Commit

Permalink
Add Rust plugin and language profile (#93)
Browse files Browse the repository at this point in the history
Closes #90

Signed-off-by: wkoot <[email protected]>
  • Loading branch information
wkoot authored Jan 29, 2025
1 parent 27f07d4 commit d1f868a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Added

- Rust plugin and language profile (#90).

### Changed

- Document the produced container images for Docker Hub (#89).
Expand Down
10 changes: 6 additions & 4 deletions MAINTENANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ Add the url of the plugin jar-file to be installed to the [config.json](https://

Modify the [config.json](https://github.com/ICTU/sonar/blob/master/src/config.json) value of `profiles` and add a key (language as profile name) with value dictionary, such as:

"yaml": {
"plugin_name": "sonar-ansible-plugin",
"rust": {
"language_profile": "Community Rust",
"plugin_name": "community-rust-plugin",
"plugin_external": true,
"version": "ansible-profile-v2.5.1"
"version": "rust-profile-v0.2.5"
},

The parameters are:
* `(key)`: language (internal SonarQube language identifier)
* `(key)`: language (internal SonarQube language identifier)
* `language_profile`: name of the language profile provided by plugin, defaults to "Sonar way"
* `plugin_name`: name of the plugin to be used for this profile
* `plugin_external`: true for external plugin, false (default) when it is contained in the base container image
* `version`: profile version string (based on the plugin version)
Expand Down
10 changes: 10 additions & 0 deletions src/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"plugins": [
"https://github.com/checkstyle/sonar-checkstyle/releases/download/10.19.0/checkstyle-sonar-plugin-10.19.0.jar",
"https://github.com/C4tWithShell/community-rust/releases/download/v0.2.5/community-rust-plugin-0.2.5.jar",
"https://github.com/dependency-check/dependency-check-sonar-plugin/releases/download/5.0.0/sonar-dependency-check-plugin-5.0.0.jar",
"https://github.com/sbaudoin/sonar-ansible/releases/download/v2.5.1/sonar-ansible-plugin-2.5.1.jar",
"https://github.com/sbaudoin/sonar-yaml/releases/download/v1.9.1/sonar-yaml-plugin-1.9.1.jar",
Expand Down Expand Up @@ -33,6 +34,12 @@
"plugin_name": "python-plugin",
"version": "py-profile-v4.22.0"
},
"rust": {
"language_profile": "Community Rust",
"plugin_name": "community-rust-plugin",
"plugin_external": true,
"version": "rust-profile-v0.2.5"
},
"swift": {
"plugin_name": "swift-plugin",
"version": "swift-profile-v4.12.0"
Expand Down Expand Up @@ -115,6 +122,9 @@
"+python:S134 # Too deep nesting; NOT used by Quality-time",
"+python:S138|max=20 # Methods with too many lines; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#long-units)"
],
"rust": [
"+community-rust:FunctionParametersCount"
],
"swift": [
"+types=SECURITY_HOTSPOT,VULNERABILITY",
"+swift:S104 # Files should not have too many lines of code. Used by Quality-time",
Expand Down
3 changes: 2 additions & 1 deletion src/start-with-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ language_profiles=$(jq -r ".profiles | keys[]?" /src/config.json)
for language_name in ${language_profiles}; do
profile_version=$(jq -r ".profiles.${language_name}.version" /src/config.json)
profile_name="ictu-${profile_version}-${rules_version}"
createProfile "${profile_name}" "Sonar%20way" "${language_name}"
copy_profile=$(jq -r ".profiles.${language_name}.language_profile // \"Sonar way\" | @uri" /src/config.json)
createProfile "${profile_name}" "${copy_profile}" "${language_name}"
done
echo "*** Finished processing rules ***"

Expand Down
1 change: 1 addition & 0 deletions tests/styles/config/vocabularies/Base/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ cs
js
[Kk]otlin
py
[Rr]ust
[Ss]wift
ts
vbnet
Expand Down

0 comments on commit d1f868a

Please sign in to comment.