addons/naming.py: fixed error report for function name

This commit is contained in:
Daniel Marjamäki 2015-07-28 14:34:37 +02:00
parent 8b8d898b96
commit 0e82730ee4
3 changed files with 6 additions and 3 deletions

View File

@ -171,10 +171,13 @@ class Function:
Id = None
argument = None
argumentId = None
tokenDef = None
tokenDefId = None
name = None
def __init__(self, element):
self.Id = element.get('id')
self.tokenDefId = element.get('tokenDef')
self.name = element.get('name')
self.argument = {}
self.argumentId = {}
@ -184,7 +187,7 @@ class Function:
def setId(self, IdMap):
for argnr, argid in self.argumentId.items():
self.argument[argnr] = IdMap[argid]
self.tokenDef = IdMap[self.tokenDefId]
class Variable:
Id = None

View File

@ -30,4 +30,4 @@ for arg in sys.argv[1:]:
for function in data.functions:
res = re.match(RE_FUNCTIONNAME, function.name)
if not res:
reportError(var.typeStartToken, 'style', 'Function ' + function.name + ' violates naming convention')
reportError(function.tokenDef, 'style', 'Function ' + function.name + ' violates naming convention')

View File

@ -2471,7 +2471,7 @@ void SymbolDatabase::printXml(std::ostream &out) const
if (!scope->functionList.empty()) {
out << " <functionList>" << std::endl;
for (std::list<Function>::const_iterator function = scope->functionList.begin(); function != scope->functionList.end(); ++function) {
out << " <function id=\"" << &*function << "\" name=\"" << function->name() << '\"';
out << " <function id=\"" << &*function << "\" tokenDef=\"" << function->tokenDef << "\" name=\"" << function->name() << '\"';
if (function->argCount() == 0U)
out << "/>" << std::endl;
else {