Project

General

Profile

rules.pl

osmith, 12/12/2018 11:26 AM

 
1
sum_list([], 0).
2
sum_list([H | Rest], Sum) :- sum_list(Rest,Tmp), Sum is H + Tmp.
3

    
4
add_category_min_score(In, Category, Min,  P) :-
5
    findall(X, gerrit:commit_label(label(Category,X),R),Z),
6
    sum_list(Z, Sum),
7
    Sum >= Min, !,
8
    gerrit:commit_label(label(Category, V), U),
9
    V >= 1,
10
    !,
11
    P = [label(Category,ok(U)) | In].
12

    
13
add_category_min_score(In, Category,Min,P) :-
14
    P = [label(Category,need(Min)) | In].
15

    
16
submit_rule(S) :-
17
    gerrit:default_submit(X),
18
    X =.. [submit | Ls],
19
    gerrit:remove_label(Ls,label('Code-Review',_),NoCR),
20
    add_category_min_score(NoCR,'Code-Review', 3, Labels),
21
    S =.. [submit | Labels].
Add picture from clipboard (Maximum size: 48.8 MB)