diff --git a/formatters/custom.go b/formatters/custom.go index cdb1e8e..c9e885d 100644 --- a/formatters/custom.go +++ b/formatters/custom.go @@ -35,6 +35,7 @@ func (f *CustomFormatter) Format(violations rules.RuleViolationList) { for _, val := range violations { err := f.template.Execute(f.out, val) + f.out.Write([]byte("\n")) if err != nil { logger.Error(err.Error()) } diff --git a/formatters/custom_test.go b/formatters/custom_test.go index b09e653..942f4cb 100644 --- a/formatters/custom_test.go +++ b/formatters/custom_test.go @@ -2,6 +2,7 @@ package formatters import ( "bytes" + "strings" "testing" "text/template" @@ -24,6 +25,7 @@ func TestCustomFormatter(t *testing.T) { assert.Regexp(t, `../fixtures/missing_phony.make:21:minphony:Missing required phony target "all"`, out.String()) assert.Regexp(t, `../fixtures/missing_phony.make:21:minphony:Missing required phony target "test"`, out.String()) assert.Regexp(t, `../fixtures/missing_phony.make:16:phonydeclared:Target "all" should be declared PHONY.`, out.String()) + assert.Equal(t, strings.Count(out.String(), "\n"), 3) } func TestCustomFormatterNewMethod(t *testing.T) {