Skip to content

Commit fb35d48

Browse files
authored
Merge pull request #2323 from ActiveState/DX-1456
projectfile deprecation: Fix commented out lines being detected
2 parents adc17bf + c284524 commit fb35d48

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

pkg/projectfile/projectfile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var (
4949
// CommitURLRe Regex used to validate commit info /commit/someUUID
5050
CommitURLRe = regexp.MustCompile(urlCommitRegexStr)
5151
// deprecatedRegex covers the deprecated fields in the project file
52-
deprecatedRegex = regexp.MustCompile(`\s*(?:constraints|platforms|languages):`)
52+
deprecatedRegex = regexp.MustCompile(`(?m)^\s*(?:constraints|platforms|languages):`)
5353
)
5454

5555
type ErrorParseProject struct{ *locale.LocalizedError }

pkg/projectfile/projectfile_test.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,11 @@ func Test_detectDeprecations(t *testing.T) {
433433
locale.Tr("pjfile_deprecation_entry", "constraints", "0"),
434434
},
435435
},
436+
{
437+
"Constraints Commented Out",
438+
`#constraints: 0`,
439+
[]string{},
440+
},
436441
{
437442
"Platforms",
438443
`platforms: 0"`,
@@ -449,10 +454,10 @@ func Test_detectDeprecations(t *testing.T) {
449454
},
450455
{
451456
"Mixed",
452-
"foo: 0\nconstraints: 0\nbar: 0\nlanguages: 0, platforms: 0",
457+
"foo: 0\nconstraints: 0\nbar: 0\nlanguages: 0\nplatforms: 0",
453458
[]string{
454-
locale.Tr("pjfile_deprecation_entry", "constraints", "6"),
455-
locale.Tr("pjfile_deprecation_entry", "languages", "28"),
459+
locale.Tr("pjfile_deprecation_entry", "constraints", "7"),
460+
locale.Tr("pjfile_deprecation_entry", "languages", "29"),
456461
locale.Tr("pjfile_deprecation_entry", "platforms", "42"),
457462
},
458463
},
@@ -466,9 +471,9 @@ languages:
466471
constraints:
467472
platform: Windows10Label,Linux64Label`,
468473
[]string{
469-
locale.Tr("pjfile_deprecation_entry", "platforms", "108"),
470-
locale.Tr("pjfile_deprecation_entry", "languages", "142"),
471-
locale.Tr("pjfile_deprecation_entry", "constraints", "166"),
474+
locale.Tr("pjfile_deprecation_entry", "platforms", "109"),
475+
locale.Tr("pjfile_deprecation_entry", "languages", "143"),
476+
locale.Tr("pjfile_deprecation_entry", "constraints", "167"),
472477
},
473478
},
474479
{

0 commit comments

Comments
 (0)