sonarqube-webapis
SonarQube / SonarCloud Web APIs Client Library for Node.js
Disclaimer
I need this library to automate projects administration tasks submitted to sonarcloud, keep the lines of code matching with current billing plan.
I only use several resources, but since I want to make it public, I have to, at least cover full SonarCloud Web API.
This library may not be up to date with latest spec of SonarQube / SonarCloud Web API.
This library may not have the best design, but it works, only depends to axios, easy to test so have very high test coverage.
This library does not do any validation, just typechecking and pass it over to web api to validate.
Install
npm install sonarqube-webapis --save
Usage Example
import { AxiosError } from 'axios';
import Sonar from 'sonarqube-webapis';
(async () => {
const sonar = new Sonar({
auth: {
username: '',
password: '',
},
baseURL: 'https://sonarcloud.io/api',
});
try {
const result = await sonar.components.search('my-org2');
console.log('Components:', result.data.components);
} catch (error) {
console.log('Errors: ',(error as AxiosError).response?.data.errors);
}
})();
License
The project is available under the MIT license.