https://github.com/badetitou/famix-critic-sonarqube-exporter
https://github.com/badetitou/famix-critic-sonarqube-exporter
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/badetitou/famix-critic-sonarqube-exporter
- Owner: badetitou
- Created: 2022-08-12T07:36:28.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-08T14:07:40.000Z (almost 3 years ago)
- Last Synced: 2025-03-03T14:48:03.965Z (8 months ago)
- Language: Smalltalk
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Famix-Critic-SonarQube-Exporter
This project aims to connect [FamixCritics](github.com/moosetechnology/MooseIDE) to [SonarQube UI](https://www.sonarqube.org/).
This package basically export the FamixViolation into the Sonar [Generic Issue Format](https://docs.sonarqube.org/latest/analysis/generic-issue/).
## Installation
```st
Metacello new
githubUser: 'badetitou' project: 'Famix-Critic-SonarQube-Exporter' commitish: 'main' path: 'src';
baseline: 'FamixCriticSonarQubeExporter';
onConflict: [ :ex | ex useIncoming ];
onUpgrade: [ :ex | ex useIncoming ];
onDowngrade: [ :ex | ex useLoaded ];
load
```## Usages
```st
FmxCBSQExporter new
violations: violations;
targetFileReference: targetRef;
export
```## Full Example
Considering a maven project.
First, create a model of the project (using [VerveineJ](https://modularmoose.org/moose-wiki/Developers/Parsers/VerveineJ)).```sh
docker pull badetitou/verveinej:v2.0.4
docker run -v :/src -v [:/dependency] badetitou/verveinej:v2.0.4 .
```Then, in a MooseImage, in a playground
```st
model := FamixJavaModel new.
'path/to/model.json' asFileReference readStreamDo: [ : stream | model importFromJSONStream: stream ].
model rootFolder: 'path/to'.criticBrowser := MiCriticBrowser on: MiCriticBrowser newModel.
'D:/rules.ston' asFileReference readStreamDo: [ :stream | criticBrowser importRulesFromStream: stream ].
criticBrowser model setEntities: model.
criticBrowser model run.
violations := criticBrowser model getAllViolations.targetRef := 'path/to/reports/sonarGenericIssue.json' asFileReference.
FmxCBSQExporter new
violations: violations;
targetFileReference: targetRef;
export
```It generates in your project under the `report` folder the created issues.
Then, add the `-Dsonar.externalIssuesReportPaths=reports\sonarGenericIssue.json` parameter to your sonar maven analyse command.```sh
mvn sonar:sonar \
"-Dsonar.projectKey=my-project" \
"-Dsonar.host.url=" \
"-Dsonar.login=" \
"-Dsonar.externalIssuesReportPaths=reports\sonarGenericIssue.json"
```