naming.py: Unify addon output
This commit is contained in:
parent
7b6d7b9335
commit
b5d9313663
|
@ -20,7 +20,6 @@ def validate_regex(expr):
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
CLI = ('--cli' in sys.argv)
|
|
||||||
RE_VARNAME = None
|
RE_VARNAME = None
|
||||||
RE_PRIVATE_MEMBER_VARIABLE = None
|
RE_PRIVATE_MEMBER_VARIABLE = None
|
||||||
RE_FUNCTIONNAME = None
|
RE_FUNCTIONNAME = None
|
||||||
|
@ -35,20 +34,11 @@ for arg in sys.argv[1:]:
|
||||||
RE_FUNCTIONNAME = arg[11:]
|
RE_FUNCTIONNAME = arg[11:]
|
||||||
validate_regex(RE_FUNCTIONNAME)
|
validate_regex(RE_FUNCTIONNAME)
|
||||||
|
|
||||||
|
|
||||||
FoundError = False
|
|
||||||
|
|
||||||
def reportError(token, severity, msg, errorId):
|
def reportError(token, severity, msg, errorId):
|
||||||
global FoundError
|
cppcheckdata.reportErrorCli(token, severity, msg, 'naming', errorId)
|
||||||
FoundError = True
|
|
||||||
msg = '[' + token.file + ':' + str(token.linenr) + ']: (' + severity + ') ' + msg + ' [naming-' + errorId + ']'
|
|
||||||
if CLI:
|
|
||||||
print(msg)
|
|
||||||
else:
|
|
||||||
sys.stderr.write(msg + '\n')
|
|
||||||
|
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
if not arg[-5:] == '.dump':
|
if not arg.endswith('.dump'):
|
||||||
continue
|
continue
|
||||||
print('Checking ' + arg + '...')
|
print('Checking ' + arg + '...')
|
||||||
data = cppcheckdata.parsedump(arg)
|
data = cppcheckdata.parsedump(arg)
|
||||||
|
@ -78,7 +68,3 @@ for arg in sys.argv[1:]:
|
||||||
reportError(
|
reportError(
|
||||||
scope.bodyStart, 'style', 'Function ' + scope.className + ' violates naming convention', 'functionName')
|
scope.bodyStart, 'style', 'Function ' + scope.className + ' violates naming convention', 'functionName')
|
||||||
|
|
||||||
if FoundError and not CLI:
|
|
||||||
print('FoundError')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue