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>
This commit is contained in:
parent
cfcc4ef8ed
commit
cff4cde412
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user