Skip to content

Commit 7de318b

Browse files
committed
chore: small logging improvements
1 parent ab2b54b commit 7de318b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
module github.com/kontrolplane/pull-request-title-validator
22

33
go 1.21.1
4-

main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ func main() {
3838
os.Exit(1)
3939
}
4040

41-
fmt.Printf("titleType: %s\n", titleType)
42-
fmt.Printf("titleScope: %s\n", titleScope)
43-
fmt.Printf("titleMessage: %s\n", titleMessage)
41+
fmt.Printf("commit title type used: %s\n", titleType)
42+
fmt.Printf("commit title scope used: %s\n", titleScope)
43+
fmt.Printf("commit title message used: %s\n", titleMessage)
4444
}
4545

4646
func fetchTitle(githubEventPath string) string {
@@ -84,6 +84,7 @@ func splitTitle(title string) (titleType string, titleScope string, titleMessage
8484
// this part of the function extracts the message
8585
if strings.Contains(title, ":") {
8686
titleMessage = strings.SplitAfter(title, ":")[1]
87+
titleMessage = strings.TrimSpace(titleMessage)
8788
} else {
8889
fmt.Println("No message was included in the pull request title.")
8990
fmt.Println(desiredFormat)
@@ -100,5 +101,5 @@ func checkAgainstConventionTypes(titleType string, conventionTypes []string) err
100101
}
101102
}
102103

103-
return fmt.Errorf("The type passed '%s' is not present in the types allowed by the convention: %s\n", titleType, conventionTypes)
104+
return fmt.Errorf("the type passed '%s' is not present in the types allowed by the convention: %s", titleType, conventionTypes)
104105
}

0 commit comments

Comments
 (0)