Skip to content

Commit c284524

Browse files
committed
Fix commented out lines being detected
1 parent 80e0e6e commit c284524

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
@@ -448,6 +448,11 @@ func Test_detectDeprecations(t *testing.T) {
448448
locale.Tr("pjfile_deprecation_entry", "constraints", "0"),
449449
},
450450
},
451+
{
452+
"Constraints Commented Out",
453+
`#constraints: 0`,
454+
[]string{},
455+
},
451456
{
452457
"Platforms",
453458
`platforms: 0"`,
@@ -464,10 +469,10 @@ func Test_detectDeprecations(t *testing.T) {
464469
},
465470
{
466471
"Mixed",
467-
"foo: 0\nconstraints: 0\nbar: 0\nlanguages: 0, platforms: 0",
472+
"foo: 0\nconstraints: 0\nbar: 0\nlanguages: 0\nplatforms: 0",
468473
[]string{
469-
locale.Tr("pjfile_deprecation_entry", "constraints", "6"),
470-
locale.Tr("pjfile_deprecation_entry", "languages", "28"),
474+
locale.Tr("pjfile_deprecation_entry", "constraints", "7"),
475+
locale.Tr("pjfile_deprecation_entry", "languages", "29"),
471476
locale.Tr("pjfile_deprecation_entry", "platforms", "42"),
472477
},
473478
},
@@ -481,9 +486,9 @@ languages:
481486
constraints:
482487
platform: Windows10Label,Linux64Label`,
483488
[]string{
484-
locale.Tr("pjfile_deprecation_entry", "platforms", "108"),
485-
locale.Tr("pjfile_deprecation_entry", "languages", "142"),
486-
locale.Tr("pjfile_deprecation_entry", "constraints", "166"),
489+
locale.Tr("pjfile_deprecation_entry", "platforms", "109"),
490+
locale.Tr("pjfile_deprecation_entry", "languages", "143"),
491+
locale.Tr("pjfile_deprecation_entry", "constraints", "167"),
487492
},
488493
},
489494
{

0 commit comments

Comments
 (0)