Skip to content

Commit

Permalink
chore: align logging with expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
levivannoort committed Nov 29, 2024
1 parent f46377c commit 6a47912
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func checkAgainstScopes(logger *slog.Logger, titleScope string, scopes []string)
return nil
}
}
logger.Error("Scope not allowed", slog.String("scope", titleScope), slog.Any("allowedScopes", scopes))

return fmt.Errorf("scope '%s' is not allowed", titleScope)
}

Expand All @@ -152,10 +152,12 @@ func parseTypes(logger *slog.Logger, input string, fallback []string) []string {
logger.Warn("No custom list of commit types passed, using fallback.")
return fallback
}

types := strings.Split(input, ",")
for i := range types {
types[i] = strings.TrimSpace(types[i])
}

return types
}

Expand All @@ -164,9 +166,11 @@ func parseScopes(logger *slog.Logger, input string) []string {
logger.Warn("No custom list of commit scopes passed, using fallback.")
return []string{}
}

scopes := strings.Split(input, ",")
for i := range scopes {
scopes[i] = strings.TrimSpace(scopes[i])
}

return scopes
}

0 comments on commit 6a47912

Please sign in to comment.