Back to the article list

31 May 2017

Introducing new failure conditions related to the current PR

With the introduction of the the SensioLabsInsight commit status on GitHub, you can configure conditions that check the quality of your project during your development process.

For example, to ensure that the quality of your project does not decrease on pull requests, you can use a configuration like the following:

commit_failure_conditions:
    - "project.severity.critical > 0"
    - "project.severity.major > 0"
    - "project.severity.minor > 0"
    - "project.severity.info >= 15"

Failure conditions and Github statuses were already a big step forward in the integration of SensioLabsInsight into your development pipeline. We made it even more powerful with failure conditions related to the current pull request.

Pull requests related failure conditions

The concept is quite simple but very useful: in addition of the project variable, you can now use the pr variable that gives access to the violations related to files modified by the pull request.

This configuration can be useful for instance in the case of legacy projects needing a migration towards better practices: instead of having a huge list of issues, you can now use SensioLabsInsight to improve your project quality steps by steps.

Here is the reference of this new variable:

commit_failure_conditions:
    - "project.severity.critical > 0"
    - "project.severity.major > 0"

    # Fail by severities count introduced by the current pull request
    # - "pr.severity.critical > 0"
    # - "pr.severity.major > 0"
    # - "pr.severity.minor > 0"
    # - "pr.severity.info >= 15"
    #
    # Fail by categories count introduced by the current pull request
    # - "pr.category.architecture > 0"
    # - "pr.category.bugrisk > 0"
    # - "pr.category.codestyle > 0"
    # - "pr.category.deadcode > 0"
    # - "pr.category.performance > 0"
    # - "pr.category.readability > 0"
    # - "pr.category.security > 0"
    #
    # Fail by total count introduced by the current pull request
    # - "pr.violations > 150"

We hope this feature will help you improve the quality of your projects, enjoy!

comments powered by Disqus