From 75624385687e36b37dd76a2e0ce22aa0774e5c27 Mon Sep 17 00:00:00 2001 From: Roland Illig Date: Fri, 4 Oct 2024 20:54:38 +0200 Subject: [PATCH] Prohibit vertical bar in COMMENT This character breaks the INDEX export, generating more columns than expected. --- v23/vartypecheck.go | 10 +++++++++- v23/vartypecheck_test.go | 10 ++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/v23/vartypecheck.go b/v23/vartypecheck.go index b316b909..a0b61143 100644 --- a/v23/vartypecheck.go +++ b/v23/vartypecheck.go @@ -263,7 +263,15 @@ func (cv *VartypeCheck) Comment() { if hasPrefix(value, "\"") && hasSuffix(value, "\"") || hasPrefix(value, "'") && hasSuffix(value, "'") { - cv.Warnf("COMMENT should not be enclosed in quotes.") + cv.Errorf("COMMENT must not be enclosed in quotes.") + } + + if contains(value, "|") { + cv.Errorf("COMMENT must not contain \"|\".") + cv.Explain( + "The vertical bar is used as a separator", + "in the package summary,", + "where it cannot be escaped.") } } diff --git a/v23/vartypecheck_test.go b/v23/vartypecheck_test.go index 31d0fc5f..daaa6908 100644 --- a/v23/vartypecheck_test.go +++ b/v23/vartypecheck_test.go @@ -325,7 +325,8 @@ func (s *Suite) Test_VartypeCheck_Comment(c *check.C) { "Converter converts between measurement units", "Converter is a unit converter", "\"Official\" office suite", - "'SQL injection fuzzer") + "'SQL injection fuzzer", + "TCR (Test && Commit || Revert) utility") vt.Output( "ERROR: filename.mk:2: COMMENT must be set.", @@ -333,14 +334,15 @@ func (s *Suite) Test_VartypeCheck_Comment(c *check.C) { "WARN: filename.mk:3: COMMENT should not end with a period.", "WARN: filename.mk:4: COMMENT should start with a capital letter.", "WARN: filename.mk:4: COMMENT should not be longer than 70 characters.", - "WARN: filename.mk:5: COMMENT should not be enclosed in quotes.", - "WARN: filename.mk:6: COMMENT should not be enclosed in quotes.", + "ERROR: filename.mk:5: COMMENT must not be enclosed in quotes.", + "ERROR: filename.mk:6: COMMENT must not be enclosed in quotes.", "WARN: filename.mk:7: COMMENT should not contain \"is a\".", "WARN: filename.mk:8: COMMENT should not contain \"is an\".", "WARN: filename.mk:9: COMMENT should not contain \"is a\".", "WARN: filename.mk:10: COMMENT should not start with the package name.", "WARN: filename.mk:11: COMMENT should not start with the package name.", - "WARN: filename.mk:11: COMMENT should not contain \"is a\".") + "WARN: filename.mk:11: COMMENT should not contain \"is a\".", + "ERROR: filename.mk:14: COMMENT must not contain \"|\".") } func (s *Suite) Test_VartypeCheck_ConfFiles(c *check.C) {