Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

elhub/devxp-sonar-phab

Repository files navigation

Warning

This project has been archived and is no longer being actively developed by Elhub.

sonar-phab

About

sonar-phab is a simple application that takes the result of a branch run of the sonarqube scanner (using the report-task.txt file generated by a scanner run) from the Sonarqube server, and then posts the results as lint comments in a Phabricator diff.

Getting Started

Prerequisites

This application requires Java 1.8 or later.

sonar-phab depends on a number of environment variables being set in order to run correctly. These are:

  • SONAR_RESULTS: The path of the sonar report task summary file (report-task.txt).
  • PHABRICATOR_URI: The URI for the Phabricator server.
  • PHABRICATOR_HARBORMASTER_PHID: The phid of Harbormaster in Phabricator.
  • PHABRICATOR_CONDUIT_TOKEN: The conduit token of the user that the process will run as.

Installation

The latest version can be downloaded from Elhub's internal artifactory under elhub-bin/sonar-phab/.

To build the current version, run:

./gradlew assemble

To publish the executable jar to artifactory, run:

./gradlew publish

Usage

Assuming environment variables have been set, using sonar-phab is simply a matter of running the binary in the working directory of the project to be processed.

java -jar sonar-phab.jar

It is assumed that the sonarId (projectKey) and sonarBranch (branch - which should correspond to the diff) can be extracted from report-task.txt.

The application thus reads report-task.txt, contacts the SonarQube server, waits for the sonar analysis to complete (if it is still ongoing), then retrieves the issues detected and post them to the Diff on phabricator indicated by the sonarBranch id.

Testing

The unit tests can be run using:

./gradlew test

Contributing

Contributing, issues and feature requests are welcome. See the Contributing file.

Owners

This project is developed by Elhub. For the specific development group responsible for this code, see the Codeowners file.

License

This project is MIT licensed.

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages