Skip to content

Commit df1d1d2

Browse files
RobinCslkodiakhq[bot]
authored andcommitted
feat: list commits that have failed check
Closes #29
1 parent 1bfb927 commit df1d1d2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cmd/root_runner.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ func runRoot(cmd *cobra.Command, args []string) error {
5656

5757
log.Printf("Found %v commit to check", len(commits))
5858

59+
faultyCommits := []plumbing.Hash{}
60+
5961
for _, commitHash := range commits {
6062
commitObject, commitErr := repo.CommitObject(commitHash)
6163

@@ -66,8 +68,18 @@ func runRoot(cmd *cobra.Command, args []string) error {
6668
textErr := text.CheckMessageTitle(commitObject.Message)
6769

6870
if textErr != nil {
69-
return textErr
71+
faultyCommits = append(faultyCommits, commitHash)
72+
}
73+
}
74+
75+
if len(faultyCommits) != 0 {
76+
for _, commitHash := range faultyCommits {
77+
log.Printf("Commit %v is not conventional commit compliant", commitHash)
7078
}
79+
80+
log.Printf("%v of %v commits are not conventional commit compliant", len(faultyCommits), len(commits))
81+
82+
return errors.New("Not all commits are conventiontal commits, please check the commits listed above")
7183
}
7284

7385
log.Printf("All %v commits are conventional commit compliant", len(commits))

0 commit comments

Comments
 (0)