From 20ec6bdd7cded862a5456495b305a93e3944fd72 Mon Sep 17 00:00:00 2001 From: Raul Catalinas <105791463+RaulCatalinas@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:53:48 +0100 Subject: [PATCH 1/2] refactor: removed forgotten magic strings - Replaced remaining magic strings with enums for consistency. --- internal/utils/user-os.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/utils/user-os.go b/internal/utils/user-os.go index 1d6422d..99e46a0 100644 --- a/internal/utils/user-os.go +++ b/internal/utils/user-os.go @@ -3,6 +3,8 @@ package utils import ( "os" "strings" + + "github.com/RaulCatalinas/HuskyBC/internal/enums" ) func createFolder(name string) { @@ -11,7 +13,7 @@ func createFolder(name string) { message := "Created folder " + name WriteMessage(WriteMessageProps{ - Type: "info", + Type: enums.MessageTypeInfo, Message: message, }) } @@ -22,7 +24,7 @@ func createFile(name string) { message := "Created file " + name WriteMessage(WriteMessageProps{ - Type: "info", + Type: enums.MessageTypeInfo, Message: message, }) } @@ -32,7 +34,7 @@ func CheckinFolderOrFile(path string, isFolder bool) { if err != nil { WriteMessage(WriteMessageProps{ - Type: "error", + Type: enums.MessageTypeError, Message: GetErrorMessage("CheckingFolderOrFile"), }) @@ -40,7 +42,7 @@ func CheckinFolderOrFile(path string, isFolder bool) { errorMessage := GetErrorMessage("NotFound") WriteMessage(WriteMessageProps{ - Type: "error", + Type: enums.MessageTypeError, Message: strings.Replace(errorMessage, "{fileName}", path, -1), }) From e31d96d37eb6cfd822fc1d6fc1c56240348facd8 Mon Sep 17 00:00:00 2001 From: Raul Catalinas <105791463+RaulCatalinas@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:56:15 +0100 Subject: [PATCH 2/2] chore: Updated errors.go and settings.json files --- .vscode/settings.json | 6 +++++- internal/constants/errors.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 49863c4..67d6165 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,9 @@ "markdownlint.config": { "default": true, "MD029": false - } + }, + "cSpell.words": [ + "Checkin", + "userinput" + ] } diff --git a/internal/constants/errors.go b/internal/constants/errors.go index efd9ce1..217baa1 100644 --- a/internal/constants/errors.go +++ b/internal/constants/errors.go @@ -25,7 +25,7 @@ var ERROR_MESSAGES = map[string]string{ "ConfigFilesCreate": "An error occurred while creating configuration files. Please try again later, if the error persists please report it on " + ISSUES + ".", - "PublishConfirmation": "An error occurred while confirming npm publication. Please try again later, if the error persists, please report it on" + ISSUES + ".", + "ShouldPublishToNpm": "An error occurred while confirming npm publication. Please try again later, if the error persists, please report it on" + ISSUES + ".", "NpmIgnoreWrite": "An error occurred while writing to the '.npmignore' file. Please try again later, if the error persists please report it on " + ISSUES + ".",