regexlint
The goal of regexlint is to find suspicious-looking constructs used in regular expressions in Pygments lexers.
Prerequisites: A recent Pygments (1.4 is fine), and python2-nose for running tests.
Downloads
Download the regexlint 1.3 tarball (sig) or browse dist/ for older versions.
Devel code, git clone git://code.timhatch.com/regexlint.git
Example Usage
With Pygments either installed or on your $PYTHONPATH, run make
test
. Assuming this passes, you can check all of Pygments with
make demo
or just your in-development plugins with python2
cmdline.py yourmodule:YourClass
.
Contributing
I welcome patches, suggestions, and bugreports. Send me an email to code@timhatch.com
Changelog
- 2012-08-27: 1.3
- This fixes some bad assumptions about wide unicode literals, is more strict about them, and is also compatible with Jython (2.5).
- 2012-03-08: 1.2
- This version adds PyPy compatibility, multiprocessing support for faster linting, has fewer false positives with bygroups(..., None, ...), and includes many more checks for character classes. The start and end data for a node is also being stored separately, in preparation for partial tree reconstruction in the next release.
- 2012-02-14: 1.1
- This version adds verbose parsing, Eric's ast-based indicator, and a few more checkers.
- 2012-01-03: 1.0
- This version is tested against Pygments 1.5-dev [81d98983fd7f] and finds ~122
issues that we need to address. At long last, I'm tagging 1.0 as the blockers
are fixed:
- The ability to check just one lexer using mod:cls (example in README)
- INFO, WARNING, and ERROR severity, with filtering on the command line
- Tests that cover all checkers
- New internal tree representation, rather than the previous list-of-tuples where everthing could have alternations
- Eric's new indicator code for regexes that require python code to execute to generate them [these show up without line numbers, but the right part of the pattern is indicated now, rather than a 'Y' line].
- Overlap/Gap checker gives many fewer false positives