Travis: Enforce naming convention, private variable names must start with 'm[A-Z]'
This commit is contained in:
parent
13cf93a322
commit
68a91b73da
|
@ -73,6 +73,9 @@ script:
|
||||||
# check gui with qt settings
|
# check gui with qt settings
|
||||||
- ${CPPCHECK} --library=qt --error-exitcode=1 -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal --exception-handling -j 2 gui --suppressions-list=.travis_suppressions -igui/test |& tee --append /tmp/cppcheck.cppcheck
|
- ${CPPCHECK} --library=qt --error-exitcode=1 -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal --exception-handling -j 2 gui --suppressions-list=.travis_suppressions -igui/test |& tee --append /tmp/cppcheck.cppcheck
|
||||||
- sh -c "! grep '^\[' /tmp/cppcheck.cppcheck"
|
- sh -c "! grep '^\[' /tmp/cppcheck.cppcheck"
|
||||||
|
# check naming conventions
|
||||||
|
- ${CPPCHECK} --dump -q lib
|
||||||
|
- python addons/naming.py --private-member-variable='m[A-Z].*' lib/*.cpp.dump
|
||||||
# run extra tests
|
# run extra tests
|
||||||
- tools/generate_and_run_more_tests.sh
|
- tools/generate_and_run_more_tests.sh
|
||||||
# Validate XML
|
# Validate XML
|
||||||
|
|
|
@ -23,7 +23,11 @@ for arg in sys.argv[1:]:
|
||||||
RE_FUNCTIONNAME = arg[11:]
|
RE_FUNCTIONNAME = arg[11:]
|
||||||
|
|
||||||
|
|
||||||
|
FoundError = False
|
||||||
|
|
||||||
def reportError(token, severity, msg):
|
def reportError(token, severity, msg):
|
||||||
|
global FoundError
|
||||||
|
FoundError = True
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
'[' + token.file + ':' + str(token.linenr) + '] (' + severity + ') naming.py: ' + msg + '\n')
|
'[' + token.file + ':' + str(token.linenr) + '] (' + severity + ') naming.py: ' + msg + '\n')
|
||||||
|
|
||||||
|
@ -56,3 +60,8 @@ for arg in sys.argv[1:]:
|
||||||
if not res:
|
if not res:
|
||||||
reportError(
|
reportError(
|
||||||
scope.bodyStart, 'style', 'Function ' + scope.className + ' violates naming convention')
|
scope.bodyStart, 'style', 'Function ' + scope.className + ' violates naming convention')
|
||||||
|
|
||||||
|
if FoundError:
|
||||||
|
print('FoundError')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue