[Geany] integrating external tools (e.g. lint)
AC
gmane.0vd at xxxxx
Tue Sep 16 10:51:44 UTC 2008
> filename:line_no: some message
I've written a simple wrapper script to reformat JSLint's (http://jslint.com)
output - see below.
That seems to work fine so far.
> Don't know if it'll be soon, maybe. When implemented it'll be a regex
> you can edit yourself.
Looking forward to it!
---------------
import sys
import subprocess
import re
# settings -- TODO: read from cofniguration file
cmd = "rhino"
lint = "/usr/share/jslint/jslint.js"
pattern = r"Lint at line (\d+) character (\d+): (.*)"
def main(args):
filename = args[1]
command = [cmd, lint, filename]
output = subprocess.Popen(command, stdout=subprocess.PIPE).communicate()[0]
print "\n".join(reformat(output, pattern, filename))
def reformat(text, pattern, filename):
results = []
regex = re.compile(pattern)
for line in text.split("\n"):
matches = regex.search(line)
if matches:
line = int(matches.groups()[0])
char = int(matches.groups()[1])
msg = matches.groups()[2]
results.append("%s:%d: [char %d] %s" % (filename, line, char, msg))
return results
if __name__ == "__main__":
sys.exit(main(sys.argv))
More information about the Users
mailing list