Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tnfhrnsss/sonarqube_slack_alarm

It is an application that sends to Slack DM when a code smell occurs in SonarQube.
https://github.com/tnfhrnsss/sonarqube_slack_alarm

codesmell slack slack-bot sonarqube

Last synced: 5 days ago
JSON representation

It is an application that sends to Slack DM when a code smell occurs in SonarQube.

Awesome Lists containing this project

README

        

# When SonarQube Detects Code Smells (include Hotspots), Send Slack DM to code author

It is an application that sends notifications to Slack when a code smell or hotspot occurs in SonarQube.

## Requirements

* This project requires Java 8 or later.
* spring boot version 3.x
* slack-api-client 1.29.2

# Usage

* You can configure the sonarqube api url and Slack details in the application.yml file.
* You cna choose delivery method. (default : dm)
* You only need to set either the Channel ID or the Channel Name.
```
monitoring:
sonarqube:
consoleUrl:
apiUrl: http://127.0.0.1:9100/api
componentKeys:
slack:
token: xoxb-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
delivery:
method: dm # dm or mention
message:
channel:
id:
name:
admin.id:
```
* When a matching user does not exist in the Slack channel, it can be configured to send a direct message to the admin.
```
admin.id: "@admin"
```

* run application
* build this project and run SonarqubeMonitoringApplication.class
* [OR] java -jar sonarqube_monitoring*.jar
* execute api
```
curl -X POST 'http://localhost:8080/sonarqube/quality/alert'
```
* [OR] you can use spring schedule. you just set the job time.
```
jobs:
cronSchedule: "0 0 9 * * 1-5"
```

## output snapshot
* dm
![slack_notification_dm](https://tnfhrnsss.github.io/docs/sub-projects/img/sonarqube_dm_alert.png)

* mention
![slack_notification_mention](https://tnfhrnsss.github.io/docs/sub-projects/img/sonarqube_mention_alert.png)

### blog reference

For further reference, please consider the following sections:

* [blog](https://tnfhrnsss.github.io/docs/sub-projects/sonarqube_codesmell_slack_notification/)