Skip to content

Instantly share code, notes, and snippets.

@chtenb
Last active June 8, 2016 10:12
Show Gist options
  • Save chtenb/5f4f808c42040ef1a8a768742ff612bd to your computer and use it in GitHub Desktop.
Save chtenb/5f4f808c42040ef1a8a768742ff612bd to your computer and use it in GitHub Desktop.
import re
from shellout import out
errors = out('cat errors.txt')
regex = re.compile(r"\[(?P<filename>[^:]+):(?P<linenumber>\d+)\]: \(performance\) "
"Function parameter '(?P<argumentname>[^']+)'")
matches = regex.findall(errors)
for match in matches:
d = match.groupdict()
filename = d['filename']
linenumber = d['linenumber']
argumentname = d['argumentname']
print(filename, linenumber, argumentname)
command = r'fate -c ":{}\n/{}\ni&<esc>" "{}"'
out(command, int(linenumber) - 1, argumentname, filename, verbose=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment