Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Github pull request decoration. #196
Since the sonar-github-plugin has been deprecated since SonarQube 7.2 the only way to get PR decoration functionality for private projects is to pay either for a SonarCloud or a Developer Edition subscription. I'm only going to say that I don't support this decision and I don't consider this to be a premium feature. Especially since it was already available for free and SonarSource made it a paid-only feature. I'll politely refrain from making any further comments about this and I'll leave it to you to judge it.
This PR intends to bring similar functionality to sonar-scala for free for public and private projects using the Community Edition.
It works very similarly to the old sonar-github-plugin, in a sense that it creates comments with issues introduced in the pull request. It is configurable via
Under the hood, it works by storing all of the identified issues in a global collection (stored in memory), which is updated by each sensor. At the end of the analysis, it talks to Github via the API to determine which issues were introduced as a part of the analysed pull request and creates inline comments for each issue.
I worked on this, with a lot of breaks, for a little while now and it's probably at a stage when I can open a draft PR to get some early feedback. It is still a WIP, with a bunch of TODOs and some things to refactor (and missing unit tests), but I think that in theory, it should work in its current state. I'm going to try to test this e2e soon before I do any more work on it.
This is should close #133 once it's ready.
BalmungSan left a comment
Amazing!!!, thanks for this feature, I really missed it
Just one other thing, there are a lot of very small files in the
yeah no worries, I'll try to compress the code into fewer files
Thanks for working on this project. We have been using it for some time already
We already went for the SQ (v7.7) developer license and did some testing with the pr decoration.
Adding the next config will enable pr decoration:
The main issue that we have is that we have to commit
Hi @jorkzijlstra, thanks for your feedback.
You shouldn't hardcode this value into your code as it's dynamic and it will change for each pull request. You'd want it to come from your CI which triggers
# Conflicts: # .gitignore # .scalafmt.conf # build.sbt # project/plugins.sbt # src/main/scala/com/mwz/sonar/scala/scalastyle/ScalastyleSensor.scala # src/main/scala/com/mwz/sonar/scala/scapegoat/ScapegoatSensor.scala # src/main/scala/com/mwz/sonar/scala/scoverage/ScoverageSensor.scala # src/test/scala/com/mwz/sonar/scala/ScalaPluginSpec.scala # src/test/scala/com/mwz/sonar/scala/scalastyle/ScalastyleSensorSpec.scala # src/test/scala/com/mwz/sonar/scala/scapegoat/ScapegoatSensorSpec.scala