1
0

Merge pull request #2532 from cuberite/CheckSpaceComparisons

StyleCheck: Check spaces around ==, <=, >=
This commit is contained in:
Mattes D 2015-10-08 18:46:27 +02:00
commit 5d376bae1c
2 changed files with 13 additions and 5 deletions

View File

@ -187,11 +187,19 @@ local g_ViolationPatterns =
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%/[a-zA-Z0-9]+", "Add space around /"}, {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%/[a-zA-Z0-9]+", "Add space around /"},
-- Check spaces around "&": -- Check spaces around "&":
{"^[a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around /"}, {"^[a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around &"},
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around /"}, {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around &"},
{"^[a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"}, {"^[a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"},
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"}, {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"},
-- Check spaces around "==", "<=" and ">=":
{"==[a-zA-Z0-9]+", "Add space after =="},
{"[a-zA-Z0-9]+==", "Add space before =="},
{"<=[a-zA-Z0-9]+", "Add space after <="},
{"[a-zA-Z0-9]+<=", "Add space before <="},
{">=[a-zA-Z0-9]+", "Add space after >="},
{"[a-zA-Z0-9]+>=", "Add space before >="},
-- We don't like "Type const *" and "Type const &". Use "const Type *" and "const Type &" instead: -- We don't like "Type const *" and "Type const &". Use "const Type *" and "const Type &" instead:
{"const %&", "Use 'const Type &' instead of 'Type const &'"}, {"const %&", "Use 'const Type &' instead of 'Type const &'"},
{"const %*", "Use 'const Type *' instead of 'Type const *'"}, {"const %*", "Use 'const Type *' instead of 'Type const *'"},