How you can continuously improve your software quality through automatic code review in your continuous integration pipeline.
Automatic Code Review from Code Inspector
Today, Code Inspector integrates even better with Github and surfaces code issues (defects and duplicates) from Pull Requests. When a Pull Request is being sent, Code Inspector compares the head and base branches and reports added or removed defects by the new code.
Validation results (positive or negative impact upon merge) are surfaced in the GitHub interface, as shown below. Any failure is explicitly shown in the Pull Request page and a detail link brings you on Code Inspector to see what are the defect being added or removed.
Merge code only without defect by combining Code Inspector and Mergify
This new integration on Github brings the ability to integrate Code Inspector with Mergify, a Github application that automatically merge your code according to your rules (code is accepted by X developers, lints are passing, etc). Code Inspector can be a new rule for Mergify so that you stop automatically merging defective code.
For example, if you specify that Mergify should merge all code if the code contains less violations or duplicates, Mergify will then merge all code as soon as these requirements are met. No need to manually merge external contributions, Code Inspector and Mergify will make sure that only code without more defect is being shipped.
On the Pull Request page, you can see all the checks that have run and also notice that Mergify automatically merged the Pull Request. No more manual work needs to be done when contributions pass your quality requirements.
On the contrary, if any merging rule specified to Mergify is not met, Mergify will not merge the code and wait for the check to pass before merging. However, maintainers can override this workflow and decide to manually merge the new code.
How to use it?
Want to start shipping good quality code now? Follow these simple steps.
Add Project on Code Inspector
Start using Code Inspector and log on the platform using Github.
Create a project on Code-Inspector and add the github repository you want to use with Mergify. When adding the repository, Code-Inspector will install webhooks on your repository to be notified when a push or a pull request event is triggered.
That is all what you need: once the repository is added, Code Inspector will analyze your master branch when new code is pushed (to show quality trends of your code base) and analyze the quality of each pull request.
Sign up on Mergify
Install Mergify on your Github account and add the repository you want to automate.
Once Mergify is installed, add a mergify.yml file at the root of your repository. The full syntax of the file is available on mergify documentation, the basics of the file should look like the following block:
- name: automatic merge when all checks pass
In the code block above, we automatically merge the code when the following conditions are met:
- There are no additional code violation introduced by the new code
- There are no additional code duplicate introduced by the new code
- The code has been approved by at least one person
Once all these conditions are met, Mergify will automatically merge your code.
Code Inspector is now integrating with more tools to help developers ship better code. The integration with Mergify is a huge win for maintainers: they can now focus on important issues (e.g. such as architecture problem and design decision) while other trivial aspects (syntax, coding violations, security issues, code duplicate) are automated with Code Inspector.
Keep in mind Code Inspector is still in beta — if you notice an issue, please contact us! We still have a ton of new exciting features coming in the next few months and we can’t wait to announce them soon!