Skip to content

Commit 5816837

Browse files
Fix linter errors
1 parent a764811 commit 5816837

3 files changed

Lines changed: 37 additions & 37 deletions

File tree

analyzer/codechecker_analyzer/analyzers/result_handler_base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ def analyzer_action_str(self):
9898
"""
9999
analyzed_file_name = os.path.basename(self.analyzed_source_file)
100100

101-
self.buildaction_hash = analyzer_action_hash(self.analyzed_source_file,
102-
self.buildaction.directory,
103-
self.buildaction.original_command)
101+
self.buildaction_hash = \
102+
analyzer_action_hash(self.analyzed_source_file,
103+
self.buildaction.directory,
104+
self.buildaction.original_command)
104105

105106
return analyzed_file_name + '_' + \
106107
str(self.buildaction.analyzer_type) + '_' + \

analyzer/codechecker_analyzer/cli/parse.py

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ def get_report_dir_status(compile_commands: list[dict[str, str]],
294294

295295
for c in compile_commands:
296296
for analyzer in supported_analyzers:
297-
file, dir, cmd = c["file"], c["directory"], c["command"]
297+
file, directory, cmd = c["file"], c["directory"], c["command"]
298298

299299
filename = os.path.basename(file)
300-
action_hash = analyzer_action_hash(file, dir, cmd)
300+
action_hash = analyzer_action_hash(file, directory, cmd)
301301

302302
plist_file = f"{filename}_{analyzer}_{action_hash}.plist"
303303
plist_err_file = plist_file + ".err"
@@ -340,35 +340,33 @@ def get_report_dir_status(compile_commands: list[dict[str, str]],
340340
if detailed_flag:
341341
out_analyzers[analyzer].update(detailed)
342342

343-
"""
344-
Expected output format example
345-
346-
{
347-
"analyzers": {
348-
"clangsa": {
349-
"summary": {
350-
"up-to-date": 2,
351-
"outdated": 0,
352-
"missing": 1,
353-
"failed": 0,
354-
"successful": 2
355-
},
356-
"up-to-date": [
357-
"/workspace/tmp/foo.cpp",
358-
"/workspace/tmp/bar.cpp",
359-
],
360-
"outdated": [],
361-
"missing": [
362-
"/workspace/tmp/test.c"
363-
],
364-
"failed": []
365-
},
366-
"clang-tidy": { ... },
367-
},
368-
"total_analyzed_compilation_commands": 2,
369-
"total_available_compilation_commands": 3
370-
}
371-
"""
343+
# Expected output format example
344+
#
345+
# {
346+
# "analyzers": {
347+
# "clangsa": {
348+
# "summary": {
349+
# "up-to-date": 2,
350+
# "outdated": 0,
351+
# "missing": 1,
352+
# "failed": 0,
353+
# "successful": 2
354+
# },
355+
# "up-to-date": [
356+
# "/workspace/tmp/foo.cpp",
357+
# "/workspace/tmp/bar.cpp",
358+
# ],
359+
# "outdated": [],
360+
# "missing": [
361+
# "/workspace/tmp/test.c"
362+
# ],
363+
# "failed": []
364+
# },
365+
# "clang-tidy": { ... },
366+
# },
367+
# "total_analyzed_compilation_commands": 2,
368+
# "total_available_compilation_commands": 3
369+
# }
372370

373371
return {
374372
"analyzers": out_analyzers,
@@ -412,8 +410,8 @@ def print_status(inputs: list[str],
412410

413411
if files:
414412
files_filter = [os.path.abspath(fp) for fp in files]
415-
compile_commands = list(filter(lambda c :
416-
c["file"] in files_filter, compile_commands))
413+
compile_commands = list(
414+
filter(lambda c: c["file"] in files_filter, compile_commands))
417415

418416
status = get_report_dir_status(compile_commands, report_dir, detailed_flag)
419417

@@ -442,7 +440,7 @@ def get_summary(analyzer):
442440
json.dump(status, sys.stdout, indent=2)
443441
elif export and output_path:
444442
output_path = os.path.abspath(output_path)
445-
with open(output_path, "w") as file:
443+
with open(output_path, "w", encoding="utf-8") as file:
446444
json.dump(status, file, indent=2)
447445
LOG.info("Status info was dumped to '%s'.", output_path)
448446

analyzer/codechecker_analyzer/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import shlex
1414
import hashlib
1515

16+
1617
def analyzer_action_hash(analyzed_source_file, build_dir, build_command):
1718
source_file = os.path.normpath(
1819
os.path.join(build_dir,

0 commit comments

Comments
 (0)