diff --git a/.github/workflows/scriptcheck.yml b/.github/workflows/scriptcheck.yml index e1516259039..570acc7b19c 100644 --- a/.github/workflows/scriptcheck.yml +++ b/.github/workflows/scriptcheck.yml @@ -89,6 +89,7 @@ jobs: python -m pip install pygments python -m pip install requests python -m pip install psutil + python -m pip install setuptools - name: run Shellcheck if: matrix.python-latest diff --git a/addons/namingng.py b/addons/namingng.py index 26be1773b91..920ea7afb09 100755 --- a/addons/namingng.py +++ b/addons/namingng.py @@ -146,6 +146,11 @@ class Config: if have_error: sys.exit(1) + # pylint: disable-next=no-member - TODO: fix this + if config.include_guard: + # pylint: disable-next=no-member - TODO: fix this + config.include_guard_header_re = config.include_guard.get('RE_HEADERFILE',"[^/].*\\.h\\Z") + return config @@ -208,6 +213,7 @@ def report_pending_ifndef(directive,column): last_fn = None pending_ifndef = None + guard_column = None phase = 0 for directive in cfg.directives: if last_fn != directive.file: @@ -219,7 +225,7 @@ def report_pending_ifndef(directive,column): if phase == -1: # ignore (the remainder of) this file continue - if not re.match(include_guard_header_re,directive.file): + if not re.match(conf.include_guard_header_re,directive.file): phase = -1 continue @@ -263,22 +269,16 @@ def report_pending_ifndef(directive,column): if pending_ifndef: report_pending_ifndef(pending_ifndef,guard_column) -def process(dumpfiles, configfile): +def process(dumpfiles, configfile, cli, debugprint): conf = loadConfig(configfile) - # pylint: disable-next=no-member - TODO: fix this - if conf.include_guard: - global include_guard_header_re - # pylint: disable-next=no-member - TODO: fix this - include_guard_header_re = conf.include_guard.get('RE_HEADERFILE',"[^/].*\\.h\\Z") - for afile in dumpfiles: if not afile[-5:] == '.dump': continue - if not args.cli: + if not cli: print('Checking ' + afile + '...') data = cppcheckdata.CppcheckData(afile) - process_data(conf,data) + process_data(conf,data,cli,debugprint) def check_file_naming(conf,data): for source_file in data.files: @@ -299,7 +299,7 @@ def check_namespace_naming(conf,data): for exp in conf.namespace: evalExpr(conf.namespace, exp, mockToken, 'Namespace') -def check_variable_naming(conf,cfg): +def check_variable_naming(conf,cfg,debugprint): for var in cfg.variables: if not var.nameToken: continue @@ -311,7 +311,7 @@ def check_variable_naming(conf,cfg): prev = prev.previous varType = prev.str + varType - if args.debugprint: + if debugprint: print("Variable Name: " + str(var.nameToken.str)) print("original Type Name: " + str(var.nameToken.valueType.originalTypeName)) print("Type Name: " + var.nameToken.valueType.type) @@ -344,7 +344,7 @@ def check_gpp_naming(conf_list,cfg,access,message): for exp in conf_list: evalExpr(conf_list, exp, mockToken, message) -def check_function_naming(conf,cfg): +def check_function_naming(conf,cfg,debugprint): for token in cfg.tokenlist: if not token.function: continue @@ -355,7 +355,7 @@ def check_function_naming(conf,cfg): while "*" in retval and len(retval.replace("*", "")) == 0: prev = prev.previous retval = prev.str + retval - if args.debugprint: + if debugprint: print("\t:: {} {}".format(retval, token.function.name)) if retval and retval in conf.function_prefixes: @@ -375,7 +375,7 @@ def check_class_naming(conf,cfg): for exp in conf.class_name: evalExpr(conf.class_name, exp, mockToken, msgType) -def process_data(conf,data): +def process_data(conf,data,cli,debugprint): if conf.file: check_file_naming(conf,data) @@ -384,13 +384,13 @@ def process_data(conf,data): unguarded_include_files = [] if conf.include_guard and conf.include_guard.get('required',1): - unguarded_include_files = [fn for fn in data.files if re.match(include_guard_header_re,fn)] + unguarded_include_files = [fn for fn in data.files if re.match(conf.include_guard_header_re,fn)] for cfg in data.configurations: - if not args.cli: + if not cli: print('Checking config %s...' % cfg.name) if conf.variable: - check_variable_naming(conf,cfg) + check_variable_naming(conf,cfg,debugprint) if conf.private_member: check_gpp_naming(conf.private_member,cfg,'Private','Private member variable') if conf.public_member: @@ -398,7 +398,7 @@ def process_data(conf,data): if conf.global_variable: check_gpp_naming(conf.global_variable,cfg,'Global','Global variable') if conf.function_name: - check_function_naming(conf,cfg) + check_function_naming(conf,cfg,debugprint) if conf.class_name: check_class_naming(conf,cfg) if conf.include_guard: @@ -416,6 +416,6 @@ def process_data(conf,data): help="Naming check config file") args = parser.parse_args() - process(args.dumpfile, args.configfile) + process(args.dumpfile, args.configfile, args.cli, args.debugprint) sys.exit(0) diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport index 84a70056fd9..3415f3b6087 100755 --- a/htmlreport/cppcheck-htmlreport +++ b/htmlreport/cppcheck-htmlreport @@ -888,11 +888,12 @@ def main() -> None: except KeyError: pass + cwe_url = "" try: if error['cwe']: cwe_url = "" + error['cwe'] + "" except KeyError: - cwe_url = "" + pass if error['severity'] in ['error', 'warning']: message_class = error['severity'] diff --git a/tools/donate-cpu-server.py b/tools/donate-cpu-server.py index 2e0ceb4918d..96d4c60fb36 100755 --- a/tools/donate-cpu-server.py +++ b/tools/donate-cpu-server.py @@ -26,7 +26,7 @@ # Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/ # Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic # changes) -SERVER_VERSION = "1.3.53" +SERVER_VERSION = "1.3.54" OLD_VERSION = '2.14.0' @@ -1204,7 +1204,7 @@ def run(self): text = check_library_function_name(self.resultPath, var_name, queryParams, nonfunc_id='unknownMacro') httpGetResponse(self.connection, text, 'text/plain') else: - filename = resultPath + url + filename = self.resultPath + url if not os.path.isfile(filename): print_ts('HTTP/1.1 404 Not Found') self.connection.send(b'HTTP/1.1 404 Not Found\r\n\r\n') diff --git a/tools/matchcompiler.py b/tools/matchcompiler.py index 229955f8dcb..e8023738b77 100755 --- a/tools/matchcompiler.py +++ b/tools/matchcompiler.py @@ -691,6 +691,8 @@ def convertFile(self, srcname, destname, line_directive): for line in srclines: if not modified: line_orig = line + else: + line_orig = None linenr += 1 # Compile Token::Match and Token::simpleMatch