From cff4cde41236fa44b6c4f94ba9f5cf550ae351b0 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 5 Dec 2022 17:47:40 +0100 Subject: [PATCH] Allow 'We mean it.' disclaimer to have follow text Replace the regex that looks for 'We mean it.' disclaimer with simple string lookup to allow the disclaimer to have a follow text or be in the middle of the sentence. Amends b89d63515bb352cecfd87e709320a2db5b6a1906 Task-number: QTBUG-87480 Change-Id: I2a9d7306beb51de62d00b79980a12da6f170df93 Reviewed-by: Robert Griebl Reviewed-by: Alexandru Croitor --- src/tools/syncqt/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tools/syncqt/main.cpp b/src/tools/syncqt/main.cpp index 24a841ba38e..c2c2fb91a12 100644 --- a/src/tools/syncqt/main.cpp +++ b/src/tools/syncqt/main.cpp @@ -972,7 +972,7 @@ public: // This regex checks if header contains 'We mean it' disclaimer. All private headers should // contain them. - static const std::regex WeMeantItRegex("\\s*// We mean it\\."); + static const std::string_view WeMeantItString("We mean it."); // The regex's check if the content of header files is wrapped with the Qt namespace macros. static const std::regex BeginNamespaceRegex("^QT_BEGIN_NAMESPACE(_[A-Z_]+)?$"); @@ -1050,7 +1050,7 @@ public: continue; } else if (line[i + 1] == '/') { // Single line comment if (!(skipChecks & WeMeantItChecks) - && std::regex_match(line, WeMeantItRegex)) { + && line.find(WeMeantItString) != std::string::npos) { hasWeMeantIt = true; continue; } @@ -1074,7 +1074,8 @@ public: } if (isMultiLineComment) { - if (!(skipChecks & WeMeantItChecks) && std::regex_match(line, WeMeantItRegex)) { + if (!(skipChecks & WeMeantItChecks) && + line.find(WeMeantItString) != std::string::npos) { hasWeMeantIt = true; continue; }