https://github.com/evref-bl/sonarqube-pharo-api
https://github.com/evref-bl/sonarqube-pharo-api
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/evref-bl/sonarqube-pharo-api
- Owner: Evref-BL
- Created: 2025-03-13T08:45:45.000Z (over 1 year ago)
- Default Branch: develop
- Last Pushed: 2025-03-13T13:59:01.000Z (over 1 year ago)
- Last Synced: 2025-03-13T14:38:10.663Z (over 1 year ago)
- Language: Smalltalk
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sonarqube-Pharo-API
[](https://github.com/Evref-BL/Sonarqube-Pharo-API/actions/workflows/continuous.yml)
[](https://coveralls.io/github/Evref-BL/Sonarqube-Pharo-API?branch=develop)
This is a Pharo client for the [Sonarqube Web API](https://next.sonarqube.com/sonarqube/web_api)
### Usage
### Installation
```st
Metacello new
githubUser: 'Evref-BL' project: 'Sonarqube-Pharo-API' commitish: 'develop' path: 'src';
baseline: 'SonarqubePharoAPI';
onConflict: [ :ex | ex useIncoming ];
load
```
### Client
To start using the API, you need to create a client instance with your Sonarqube host and a pivate token for authentication. Here’s an example:
```st
sonarApi := SonarqubeApi new host: '.com';
privateToken: ''.
```
Replace `` with your Sonarqube domain and `` with your private token.
### Ressources
The API is divided into several resources, each corresponding to a specific part of the Sonarqube API. Here are the current available resources:
- projectAnalyses
- issues
Each resource provides methods for interacting with the corresponding Bitbucket resource. You can access them like this:
```st
sonarApi projectAnalyses
```
### Examples
#### Get all analyses of a project
```st
params := {
'project' -> ''
} asDictionary.
sonarApi projectAnalyses searchWithParams: params.
```
Replace `` with the key of the project you want to get the analyses of.
### Utils
DateAndTime's `printString` does not return the correct format required by the Sonarqube API. To convert a Pharo `DateAndTime` into the appropriate format for Sonarqube, use the method `formatDate: aDateAndTime`.
For exemple if you want to get all the analyses of a project durring the last 7 days you can use this code:
```st
params := {
'project' -> ''.
'from' -> (sonarApi formatDate: (DateAndTime now - 7 days))
} asDictionary.
sonarApi projectAnalyses searchWithParams: params.
```
replace `` with the key of the project you want to get the analyses of.