Skip to content

Commit

Permalink
Allow 'We mean it.' disclaimer to have follow text
Browse files Browse the repository at this point in the history
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 b89d635

Task-number: QTBUG-87480
Change-Id: I2a9d7306beb51de62d00b79980a12da6f170df93
Reviewed-by: Robert Griebl <[email protected]>
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
semlanik committed Dec 7, 2022
1 parent cfcc4ef commit cff4cde
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/tools/syncqt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ class SyncScanner

// 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_]+)?$");
Expand Down Expand Up @@ -1050,7 +1050,7 @@ class SyncScanner
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;
}
Expand All @@ -1074,7 +1074,8 @@ class SyncScanner
}

if (isMultiLineComment) {
if (!(skipChecks & WeMeantItChecks) && std::regex_match(line, WeMeantItRegex)) {
if (!(skipChecks & WeMeantItChecks) &&
line.find(WeMeantItString) != std::string::npos) {
hasWeMeantIt = true;
continue;
}
Expand Down

0 comments on commit cff4cde

Please sign in to comment.