File tree Expand file tree Collapse file tree 2 files changed +25
-25
lines changed Expand file tree Collapse file tree 2 files changed +25
-25
lines changed Original file line number Diff line number Diff line change 8484 end
8585end
8686
87- desc "verify that commit messages match CONTRIBUTING.md requirements"
88- task ( :commits ) do
89- # This rake task looks at the summary from every commit from this branch not
90- # in the branch targeted for a PR.
91- commit_range = 'HEAD^..HEAD'
92- puts "Checking commits #{ commit_range } "
93- %x{git log --no-merges --pretty=%s #{ commit_range } } . each_line do |commit_summary |
94- # This regex tests for the currently supported commit summary tokens.
95- # The exception tries to explain it in more full.
96- if /^\( (maint|packaging|doc|docs|modules-\d +)\) |revert/i . match ( commit_summary ) . nil?
97- raise "\n \n \n \t This commit summary didn't match CONTRIBUTING.md guidelines:\n " \
98- "\n \t \t #{ commit_summary } \n " \
99- "\t The commit summary (i.e. the first line of the commit message) should start with one of:\n " \
100- "\t \t (MODULES-<digits>) # this is most common and should be a ticket at tickets.puppet.com\n " \
101- "\t \t (docs)\n " \
102- "\t \t (docs)(DOCUMENT-<digits>)\n " \
103- "\t \t (packaging)\n "
104- "\t \t (maint)\n " \
105- "\n \t This test for the commit summary is case-insensitive.\n \n \n "
106- else
107- puts "#{ commit_summary } "
108- end
109- puts "...passed"
110- end
111- end
Original file line number Diff line number Diff line change 1+ desc "verify that commit messages match CONTRIBUTING.md requirements"
2+ task ( :commits ) do
3+ # This rake task looks at the summary from every commit from this branch not
4+ # in the branch targeted for a PR.
5+ commit_range = 'HEAD^..HEAD'
6+ puts "Checking commits #{ commit_range } "
7+ %x{git log --no-merges --pretty=%s #{ commit_range } } . each_line do |commit_summary |
8+ # This regex tests for the currently supported commit summary tokens.
9+ # The exception tries to explain it in more full.
10+ if /^\( (maint|packaging|doc|docs|modules-\d +)\) |revert/i . match ( commit_summary ) . nil?
11+ raise "\n \n \n \t This commit summary didn't match CONTRIBUTING.md guidelines:\n " \
12+ "\n \t \t #{ commit_summary } \n " \
13+ "\t The commit summary (i.e. the first line of the commit message) should start with one of:\n " \
14+ "\t \t (MODULES-<digits>) # this is most common and should be a ticket at tickets.puppet.com\n " \
15+ "\t \t (docs)\n " \
16+ "\t \t (docs)(DOCUMENT-<digits>)\n " \
17+ "\t \t (packaging)\n "
18+ "\t \t (maint)\n " \
19+ "\n \t This test for the commit summary is case-insensitive.\n \n \n "
20+ else
21+ puts "#{ commit_summary } "
22+ end
23+ puts "...passed"
24+ end
25+ end
You can’t perform that action at this time.
0 commit comments