refactor: Rename clean function to cleanMessage for clarity and consistency

The code changes in `aviation_parser.go` and `aviation_parser_test.go` rename the `clean` function to `cleanMessage` to improve clarity and consistency in function naming. This change ensures that the function's purpose is more accurately reflected in its name, making it easier for developers to understand and maintain the code.
This commit is contained in:
windyboy
2024-07-24 14:38:32 +08:00
parent 5a61d52fc4
commit 15f15ec146
2 changed files with 55 additions and 3 deletions
+2 -2
View File
@@ -164,7 +164,7 @@ func Parse(rawText string) (*domain.ParsedMessage, error) {
return &message, nil
}
func clean(text string) string {
func cleanMessage(text string) string {
cleanedText := emptyLineRemove.ReplaceAllString(text, "")
cleanText := strings.ReplaceAll(cleanedText, "\n\n", "\n")
if match := bodyOnly.FindStringSubmatch(cleanText); len(match) > 1 {
@@ -179,7 +179,7 @@ func clean(text string) string {
func ParseHeader(fullMessage string) (domain.ParsedMessage, error) {
log := utils.GetSugaredLogger()
fullMessage = clean(fullMessage)
fullMessage = cleanMessage(fullMessage)
lines := strings.Split(fullMessage, "\n")
if len(lines) < 3 {