Last active
October 2, 2017 09:37
-
-
Save abitrolly/6ab1af736760d78ef6b03a2307a67c55 to your computer and use it in GitHub Desktop.
Count Rust compile warning from build log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
logfile = 'log.txt?deansi=true' | |
import re | |
from collections import OrderedDict as odict | |
compiling = re.compile('^ *Compiling ([-\w]+) ([^\( ]+)') | |
warning = re.compile('^warning: (.*)') | |
# lib, warnings | |
table = odict() | |
lib = None | |
for line in open(logfile, 'rb'): | |
match = compiling.match(line.strip()) | |
if match != None: | |
lib, version = match.groups() | |
lib = lib + " " + version | |
table[lib] = 0 | |
else: | |
match = warning.match(line.strip()) | |
if match != None: | |
#print(line) | |
table[lib] += 1 | |
for lib in table: | |
if table[lib] != 0: | |
print("{1:5} {0}".format(lib, table[lib])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment