Skip to content

Commit

Permalink
Merge pull request #22 from arkedge/refactor-extract-compile-log-script
Browse files Browse the repository at this point in the history
Refactor remove duplicate error/warning script
  • Loading branch information
sksat authored Feb 8, 2024
2 parents 0ea5b48 + 12d5570 commit d7fc81d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions remove_duplicate_error.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import sys

file = sys.argv[1]
compiler = sys.argv[2]
cc_cmd = sys.argv[2] # it will be clang-tidy absolute path

with open(file) as f:
s = f.read()
log = s.split(compiler)

# skip until the first compile log
print(s[:s.find(cc_cmd)], end="")
s = s[s.find(cc_cmd):]

log = s.split(cc_cmd) # error or warning log per file
if "" in log:
log.remove("")
# print(log)
Expand All @@ -14,7 +19,8 @@
for l in log: # noqa: E741
(cmd, err) = l.split("\n", 1)
if err in errors:
print("duplicate: " + cmd, file=sys.stderr)
#print("duplicate: " + cmd, file=sys.stderr)
pass
else:
errors.append(err)
print(compiler + l, end="")
print("CC" + l, end="")

0 comments on commit d7fc81d

Please sign in to comment.