Created
January 27, 2021 12:40
-
-
Save matrixcloud/f19fa810f2b709bf369c3dbeac3e242c to your computer and use it in GitHub Desktop.
Gerrit commit message check for all projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%filter to require all projects to have correct commit message | |
submit_filter(In, Out) :- | |
%unpack the submit rule into a list of code reviews | |
In =.. [submit | Ls], | |
%add commit message validator | |
require_commit_message_check(Ls, R), | |
%pack the list back up and return it | |
Out =.. [submit | R]. | |
require_commit_message_check(S1, S2) :- | |
gerrit:commit_message_matches('^US|CR#[A-Z]+-\\d+:\\s[\\w\\W]+'), | |
!, | |
S2 = [label('Commit-Message', ok(user(1000))) | S1]. | |
require_commit_message_check(S1, S2) :- | |
!, | |
S2 = [label('Commit-Message', reject(user(1000))) | S1]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment