In this page
What is a check?
A check is a mechanism used to enforce rules or validate conditions to ensure code quality and compliance during the development process.
Conceptually, you can think of this as a function that runs on specific events of the development process with well-defined inputs and outputs:
Check types
There are three types of checks, each running at a specific stage of the development workflow. They complement each other to enforce the commit policy effectively and should be used together for optimal developer experience and results.
Check type | When | Purpose | What if the policy violated? |
---|---|---|---|
Local check | Runs locally, before creating a new commit. | Ensures that the new commit is compliant with the policy, thus protects your local repository. (Earliest check in the workflow!) | You cannot create the commit. |
Push check | Runs on Bitbucket, when pushing commits to the Bitbucket hosted repository. | Ensures that the pushed commits are compliant with the policy, thus protects the Bitbucket hosted repository. | You cannot push the commits. |
Merge check | Runs on Bitbucket, before merging a pull request. | Ensures that the pull request is compliant with the policy, thus protects the target repository and branch. | You cannot merge the pull request. |
Check input
Checks receive the following inputs:
- Commit policy: A named set of rules that will be checked against every subject you are trying to send into the Git repository.
-
Subject:
One or more objects to run the check against. Supported subject types include:
- Commits
- Branches
- Tags
- Pull requests (including their titles, descriptions, source, and destination branches)
Check output
As a result, checks produce the following outputs:
- Status: A summary of the check's execution, indicating whether the commit policy was satisfied, violated, or if there were any issues during the process (e.g., technical errors or timeouts).
- Violations: A detailed list specifying which objects violated which rules. If the commit policy was satisfied, the violations list will be empty, indicating that no rules were broken.
Status
Check runs complete with one of the following statuses:
Status | Description |
---|---|
Satisfied | The check ran successfully, and all conditions in the commit policy were satisfied. |
N violation(s) | The check ran successfully, but one or more (N) conditions in the commit policy were violated. |
In progress | The check is currently in progress and has not yet completed. |
Blocked | The check could not be run due to an external reason (e.g. missing or invalid commit policy configuration). |
Timed out | The check took too long, and it was terminated due to exceeding the time limit. |
Failed | An unexpected technical problem occurred during the run of the check. |
Not run yet | The check has not been run yet. |
Violations
Each violation is described by the follow details:
- Subject type (e.g. commit or pull request)
- Subject ID (e.g. commit hash or pull request ID)
- Description (e.g. "does not include a valid issue key" or "does not have the expected format")
- Hint (optional): A suggestion on how to resolve the violation
Questions?
Ask us any time.