MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / check_function_naming

Function check_function_naming

addons/namingng.py:346–366  ·  view source on GitHub ↗
(conf,cfg,debugprint)

Source from the content-addressed store, hash-verified

344 evalExpr(conf_list, exp, mockToken, message)
345
346def check_function_naming(conf,cfg,debugprint):
347 for token in cfg.tokenlist:
348 if not token.function:
349 continue
350 if token.function.type in ('Constructor', 'Destructor', 'CopyConstructor', 'MoveConstructor'):
351 continue
352 retval = token.previous.str
353 prev = token.previous
354 while "*" in retval and len(retval.replace("*", "")) == 0:
355 prev = prev.previous
356 retval = prev.str + retval
357 if debugprint:
358 print("\t:: {} {}".format(retval, token.function.name))
359
360 if retval and retval in conf.function_prefixes:
361 if not token.function.name.startswith(conf.function_prefixes[retval]):
362 reportNamingError(token, 'Function ' + token.function.name + ' violates naming convention', column=token.column)
363 mockToken = DataStruct(token.file, token.linenr, token.function.name, token.column)
364 msgType = 'Function'
365 for exp in conf.function_name:
366 evalExpr(conf.function_name, exp, mockToken, msgType)
367
368def check_class_naming(conf,cfg):
369 for fnc in cfg.functions:

Callers 1

process_dataFunction · 0.85

Calls 5

reportNamingErrorFunction · 0.85
DataStructClass · 0.85
evalExprFunction · 0.85
formatMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected