mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-05 05:58:44 +00:00
trim whitespace from comments before parsing (#2287)
This commit is contained in:
@@ -113,7 +113,9 @@ type CommentParseResult struct {
|
||||
// - atlantis version
|
||||
// - atlantis approve_policies
|
||||
//
|
||||
func (e *CommentParser) Parse(comment string, vcsHost models.VCSHostType) CommentParseResult {
|
||||
func (e *CommentParser) Parse(rawComment string, vcsHost models.VCSHostType) CommentParseResult {
|
||||
comment := strings.TrimSpace(rawComment)
|
||||
|
||||
if multiLineRegex.MatchString(comment) {
|
||||
return CommentParseResult{Ignore: true}
|
||||
}
|
||||
@@ -427,7 +429,7 @@ var DidYouMeanAtlantisComment = "Did you mean to use `atlantis` instead of `terr
|
||||
// `atlantis unlock` with flags.
|
||||
|
||||
var UnlockUsage = "`Usage of unlock:`\n\n ```cmake\n" +
|
||||
`atlantis unlock
|
||||
`atlantis unlock
|
||||
|
||||
Unlocks the entire PR and discards all plans in this PR.
|
||||
Arguments or flags are not supported at the moment.
|
||||
|
||||
@@ -280,6 +280,10 @@ func TestParse_Multiline(t *testing.T) {
|
||||
"atlantis plan\n\n",
|
||||
"atlantis plan\r\n",
|
||||
"atlantis plan\r\n\r\n",
|
||||
"\natlantis plan",
|
||||
"\r\natlantis plan",
|
||||
"\natlantis plan\n",
|
||||
"\r\natlantis plan\r\n",
|
||||
}
|
||||
for _, comment := range comments {
|
||||
t.Run(comment, func(t *testing.T) {
|
||||
@@ -845,7 +849,7 @@ var ApprovePolicyUsage = `Usage of approve_policies:
|
||||
--verbose Append Atlantis log to comment.
|
||||
`
|
||||
var UnlockUsage = "`Usage of unlock:`\n\n ```cmake\n" +
|
||||
`atlantis unlock
|
||||
`atlantis unlock
|
||||
|
||||
Unlocks the entire PR and discards all plans in this PR.
|
||||
Arguments or flags are not supported at the moment.
|
||||
|
||||
Reference in New Issue
Block a user