Merge pull request #5606 from yandex/check-for-namespace-comments-style

Check for namespace comments in "check-style" tool
This commit is contained in:
alexey-milovidov 2019-06-13 17:47:27 +03:00 committed by GitHub
commit 0a08d36f3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,4 +19,9 @@ find $ROOT_PATH/dbms -name '*.h' -or -name '*.cpp' |
xargs grep $@ -P '((class|struct|namespace|enum|if|for|while|else|throw|switch).*|\)(\s*const)?(\s*override)?\s*)\{$|\s$|\t|^ {1,3}[^\* ]\S|\t|^\s*(if|else if|if constexpr|else if constexpr|for|while|catch|switch)\(|\( [^\s\\]|\S \)' |
# a curly brace not in a new line, but not for the case of C++11 init or agg. initialization | trailing whitespace | number of ws not a multiple of 4, but not in the case of comment continuation | a tab character | missing whitespace after for/if/while... before opening brace | whitespaces inside braces
grep -v -P '(//|:\s+\*|\$\(\()| \)"'
# single-line comment | continuation of a multiline comment | a typical piece of embedded shell code | something like ending of raw string literal
# single-line comment | continuation of a multiline comment | a typical piece of embedded shell code | something like ending of raw string literal
# // namespace comments are unneeded
find $ROOT_PATH/dbms -name '*.h' -or -name '*.cpp' |
grep -vP 'Compiler|build' |
xargs grep $@ -P '}\s*//+\s*namespace\s*'