L&D series: Boost support for Pull request

Ferawati Hartanti Pratiwi
3 min readJan 25, 2021
https://cdn-media-1.freecodecamp.org/images/h7n4CPzzBvjkUfIT30AQ48qJ0ksUOCYrv-La

Learning and Development chapter 14.

SonarCloud

SonarCloud is a cloud version of SonarQube. We can visit SonarCloud on https://sonarcloud.io/.

Eliminate bugs and vulnerabilities.
Champion quality code in your projects.

We can integrate our Github or Gitlab repository with this code analysis.

https://blog.jdriven.com/uploads/2019/08/jenkins-pr-check.png

SonarCloud has dashboard view also to monitoring how many quality code that should we repair.

https://res.cloudinary.com/practicaldev/image/fetch/s--6uYLsiSA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/remast/remast.github.io/raw/master/posts/2019-11_Go-for-SonarCloud-with-Github-Actions/go-sonarcloud-dashboard.png

Make sure we’re already have account in SonarCloud the logged in. On the home page, click My Organizations.

Go to Organization settings menu and Choose the organization on Github.

Binding SonarCloud with Github
Left: Choose mpermperpisang. Right: Choose selected repository or for all repository
Organization bound successfully

Check in the repo Settings. We can also configure what can SonarCloud do to our repo.

Check in repo Settings

When we create the pull request, SonarCloud bot will comment the quality result.

Dangerfile

Dangerfile is also a support to our pull request. But unlike SonarCloud which is useful for code analysis only, dangerfile can also to tidy up our pull request format. Want to auto assign reviewer? We can do that with help from Dangerfile.

Prepare the Dangerfile file. Looks like this.

Let’s initiate the Dangerfile content!!! (Be aware it’s dangerous :D)

The syntax for Ruby is right here https://danger.systems/reference.html. We can choose another different language for an example JS, Swift, Kotlin and Python.

If we don’t want the pull request title to contain some word then we can use.

failed ‘PR title can't be named ASD123’ if github.pr_title.include? ‘[ASD123]’

We can use Ruby Gems for Dangerfile. As an example, we want to auto assign reviewer if PR creator not assigned any reviewer. Using this https://rubygems.org/gems/danger-review_requests/versions/0.0.4 and put it in the Dangerfile.

Left: Put danger-review_requests in Gemfile. Right: Call method with review_requests.request(reviewer_sample)

We can use array and random the reviewer then assign to the pull request. We also can add a Rubocop for Ruby, example https://github.com/mpermperpisang/golang-automation/blob/master/Dangerfile#L14.

Novoda

Novoda has so many repositories. One of them is gradle-static-analysis-plugin.

A Gradle plugin to easily apply the same setup of static analysis tools across different Android, Java or Kotlin projects.

This plugin supports many static analysis tools for different language, especially for Java. The list are :

We can choose some of supporting tools to support the code analysis with the gradle checker in our pull request.

https://atlassianblog.wpengine.com/wp-content/uploads/bitbucket411-blog-1200x-branches2.png

Let’s make the pull request fun to be created or reviewed. — MperMperPisang

References

  • https://sonarcloud.io/
  • https://danger.systems/
  • https://github.com/novoda/gradle-static-analysis-plugin

--

--

Ferawati Hartanti Pratiwi

QA (Quality Ambassador) | mpermperpisang official Medium account