diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2022-12-05 17:47:40 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2022-12-07 14:58:41 +0100 |
commit | cff4cde41236fa44b6c4f94ba9f5cf550ae351b0 (patch) | |
tree | 26e1799f68241d9598f608d81f7bcac7a8990cf7 | |
parent | cfcc4ef8edc4e8256ae738bbe8c23b4204021830 (diff) |
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 <robert.griebl@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | src/tools/syncqt/main.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/syncqt/main.cpp b/src/tools/syncqt/main.cpp index 24a841ba38..c2c2fb91a1 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; } |