fix: wrap lines by default

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2023-03-28 22:14:05 +02:00
parent 6ce54fd3ac
commit 0a51038cb3
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -17,12 +17,10 @@ func GetSeparatorForMultiline(config *Config) string {
} }
func FormatComment(config *Config, body string, beenWrapped bool) string { func FormatComment(config *Config, body string, beenWrapped bool) string {
if beenWrapped {
if !config.Language.OnSeparateLine { if !config.Language.OnSeparateLine {
body = strings.TrimPrefix(body, config.Language.Continuation) body = strings.TrimPrefix(body, config.Language.Continuation)
} }
body = strings.TrimRightFunc(body, unicode.IsSpace) body = strings.TrimRightFunc(body, unicode.IsSpace)
}
return fmt.Sprintf("%s%s%s", config.Language.Opening, body, config.Language.Closing) return fmt.Sprintf("%s%s%s", config.Language.Opening, body, config.Language.Closing)
} }
@ -30,9 +28,7 @@ func ProcessComment(config *Config, wrapper *wrap.Wrapper, comment *gitea.PullRe
body := comment.Body body := comment.Body
beenWrapped := len(body)+len(config.Language.Opening)+len(config.Language.Closing) > 100 beenWrapped := len(body)+len(config.Language.Opening)+len(config.Language.Closing) > 100
if beenWrapped { body = GetSeparatorForMultiline(config) + wrapper.Wrap(body, 100)
body = GetSeparatorForMultiline(config) + wrapper.Wrap(body, 100)
}
body = strings.Replace(body, "\r", "", -1) body = strings.Replace(body, "\r", "", -1)
body = strings.Replace( body = strings.Replace(