Created
October 17, 2013 07:05
-
-
Save alexgarel/7020344 to your computer and use it in GitHub Desktop.
Using Geany and launching jslint (with eg.node-jslint). This script parse jslint output and add line filename and line numbers and produce an output suitable for Geany (underlining errors and jumping to related line as you cilck on jslint ouput).
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 python3 | |
""" | |
Jslint output reformater for Geany | |
When defining your compile command in geany use:: | |
/path/to/jslint %f |/path/to/jslint_out_for_geany.py | |
""" | |
import re | |
import sys | |
line_indic = re.compile(r"// Line (?P<line>\d+), Pos (?P<pos>\d+)") | |
fname = None | |
comment = '' | |
while True: | |
l = sys.stdin.readline() | |
if not l: | |
break | |
# first line is fname | |
if fname is None and l != "\n": | |
fname = l.rstrip('\n') | |
print(fname) | |
continue | |
indic = line_indic.search(l) | |
comment += l | |
if indic: | |
print("%s:%s:%s " % (fname, indic.group('line'), indic.group('pos')), comment, end='') | |
comment = '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment