diff --git a/aspell/aspell.go b/aspell/aspell.go index f2087a8..cb950be 100644 --- a/aspell/aspell.go +++ b/aspell/aspell.go @@ -115,18 +115,23 @@ func (a Aspell) checkSingle(data string, allowedWords []string) error { func (a Aspell) Check(subjects []string, commitsFull []string, content []map[string]string) error { var commitsFullData []string for _, c := range commitsFull { - c2 := strings.TrimSpace(c) - if c2 == "" || - strings.HasPrefix(c2, "Signed-off-by:") || - strings.HasPrefix(c2, "Reviewed-by:") || - strings.HasPrefix(c2, "Tested-by:") || - strings.HasPrefix(c2, "Helped-by:") || - strings.HasPrefix(c2, "Reported-by:") || - strings.HasPrefix(c2, "Author:") || - strings.HasPrefix(c2, "Co-authored-by:") { - continue + commit := []string{} + lines := strings.Split(c, "\n") + for _, l := range lines { + c2 := strings.TrimSpace(l) + if strings.HasPrefix(c2, "Signed-off-by:") || + strings.HasPrefix(c2, "Reviewed-by:") || + strings.HasPrefix(c2, "Tested-by:") || + strings.HasPrefix(c2, "Helped-by:") || + strings.HasPrefix(c2, "Reported-by:") || + strings.HasPrefix(c2, "Author:") || + strings.HasPrefix(c2, "Co-authored-by:") { + continue + } + + commit = append(commit, l) } - commitsFullData = append(commitsFullData, c) + commitsFullData = append(commitsFullData, strings.Join(commit, "\n")) } var response string diff --git a/aspell/aspell_test.go b/aspell/aspell_test.go index 1b41fd7..92af5bf 100644 --- a/aspell/aspell_test.go +++ b/aspell/aspell_test.go @@ -82,6 +82,21 @@ func TestAspell_Check(t *testing.T) { content: []map[string]string{{"test": "test"}}, }, true, + }, { + "Signed off 2", + fields{ + Mode: modeCommit, + MinLength: 3, + IgnoreFiles: []string{"config"}, + AllowedWords: []string{"config"}, + HelpText: "test", + }, + args{ + subjects: []string{"BUG/MEDIUM: config: add default location of path to the configuration file"}, + commitsFull: []string{"some commit info\n\n Signed-off-by: Author: A locatoin "}, + content: []map[string]string{{"test": "test"}}, + }, + false, }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {