Have you ever wanted that, all the coding norms and standardization must be follow by your team so that we can never get bugs related to code carelessness.
So, Danger is here to must your coding norms.
Danger is a Ruby gem and it works during CI process. Using danger you can automate code review process as per your coding norms. So that, developers can focus on real problems.
You need to integrate two file:
Add this two files to your project root directory itself and ensure it is also added to VCS. So that CI can have access to this files.
Now, from Github you need to generate Personal Access Token (Here is Link) and add this token to your CI ENV variables and depend on CI add some script to execute danger.
After execution of danger as per coding norms you have provided if there are some Errors/Warning, DangerBot will comment on PR discussion.
Danger is designed to execute on Pull Requests only and it can’t execute on Single/Merge commits. So make sure your CI has write access to PR branches.
You can use numbers on plugins to define your coding norms. You can even create your own plugin by following this simple steps. To integrate them just add it to your GemFile and you can use it to your Dangerfile. Like here in snippet I have use TODOist to warn me for left ToDo/fixme entries.
Here is code snippet from my danger file.
#check pull request summary body, fail if it's lenght < 5 if github.pr_body.length < 5 fail "Please provide a summary in the Pull Request description" end #check is PR title has [WIP] in it warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]" #check if it's big PR, and suggest to divide them in multiple PRs warn("Big PR, try to keep changes smaller if you can") if git.lines_of_code > 500 #warn for left todo/fixme entries with custom message todoist.message = "Please fix all TODOS" todoist.warn_for_todos
Buddybuild has an integration for Danger already built-in. What you need to do is to add your Gemfile and Dangerfile in repo and you should be all set-up. BuddyBuild Bot will comment on your PR discussion on behalf of Danger.
SoluteLabs is a high-performance team of 25 focused on mobile and web design and development; we have produced top #10 chart topping applications on Android and iOS app stores, graphics that have gone viral and applications with Millions of downloads.