Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: message format #373

Merged
merged 2 commits into from
Mar 2, 2025
Merged

Conversation

alex-souslik-hs
Copy link
Contributor

@alex-souslik-hs alex-souslik-hs commented Mar 2, 2025

Currently, these two messages are printed in a code block like this:

## Kubechecks %s Report
No changes

Instead of like this:

Kubechecks %s Report

No changes

This PR should fix it.

Signed-off-by: Alex <alex.souslik@workday.com>
Signed-off-by: Alex <alex.souslik@workday.com>
@zapier-sre-bot
Copy link
Collaborator

Mergecat's Review

Click to read mergecats review!

😼 Mergecat review of pkg/events/check.go

@@ -275,10 +275,7 @@ func (ce *CheckEvent) Process(ctx context.Context) error {
 
 	if len(ce.affectedItems.Applications) <= 0 && len(ce.affectedItems.ApplicationSets) <= 0 {
 		ce.logger.Info().Msg("No affected apps or appsets, skipping")
-		if _, err := ce.ctr.VcsClient.PostMessage(ctx, ce.pullRequest, fmt.Sprintf(`
-		## Kubechecks %s Report
-		No changes
-		`, ce.ctr.Config.Identifier)); err != nil {
+		if _, err := ce.ctr.VcsClient.PostMessage(ctx, ce.pullRequest, fmt.Sprintf("## Kubechecks %s Report\nNo changes", ce.ctr.Config.Identifier)); err != nil {
 			return errors.Wrap(err, "failed to post changes")
 		}
 		return nil
@@ -390,7 +387,7 @@ func (ce *CheckEvent) CommitStatus(ctx context.Context, status pkg.CommitState)
 
 const (
 	errorCommentFormat = `
-:warning:  **Error while %s** :warning: 
+:warning:  **Error while %s** :warning:
 ` + "```" + `
 %v
 ` + "```" + `
@@ -406,7 +403,5 @@ func (ce *CheckEvent) createNote(ctx context.Context) (*msg.Message, error) {
 
 	ce.logger.Info().Msgf("Creating note")
 
-	return ce.ctr.VcsClient.PostMessage(ctx, ce.pullRequest, fmt.Sprintf(`
-	## Kubechecks %s Report
-	:hourglass: kubechecks running ... `, ce.ctr.Config.Identifier))
+	return ce.ctr.VcsClient.PostMessage(ctx, ce.pullRequest, fmt.Sprintf("## Kubechecks %s Report\n:hourglass: kubechecks running...", ce.ctr.Config.Identifier))
 }

Feedback & Suggestions:

  1. String Formatting Consistency: The changes in the diff improve the consistency of string formatting by removing unnecessary newlines and spaces. This makes the code cleaner and easier to read. However, ensure that these changes do not affect the intended formatting of the output messages, especially if they are meant to be displayed in a specific format in the user interface.

  2. Error Handling: The error handling remains consistent with the original code, which is good. Always ensure that any changes in string formatting do not inadvertently affect error messages or logs, as these are crucial for debugging.

  3. Code Readability: The removal of extra spaces and newlines enhances the readability of the code. This is a positive change as it aligns with standard coding practices for cleaner and more maintainable code.

Overall, the changes are beneficial for code readability and maintainability. Keep up the good work! 🚀



Dependency Review

Click to read mergecats review!

No suggestions found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants