Skip to content

Instantly share code, notes, and snippets.

Created Feb 9, 2016
What would you like to do?
Twistedchecker for flycheck (Emacs)
;; Define the checker
(flycheck-define-checker python-twistedchecker
"A Python syntax and style checker using twistedchecker."
:command ("twistedchecker"
;; Need `source-inplace' for relative imports (e.g. `from .foo
;; import bar'), see
(lambda (errors)
(flycheck-sanitize-errors (flycheck-increment-error-columns errors)))
((error line-start (or "E" "F") (id (one-or-more (not (any ":")))) ":"
(zero-or-more " ") line "," column ":" (message) line-end)
(warning line-start (or "W" "R" "C") (id (one-or-more (not (any ":")))) ":"
(zero-or-more " ") line "," column ":" (message) line-end))
:modes python-mode)
(add-to-list 'flycheck-checkers 'python-twistedchecker 'append)
;; Chain to another checker (I use flake8, for example)
(flycheck-add-next-checker 'python-twistedchecker 'python-flake8)
;; Activate this checker for all Python files (you probably don't want this
;; unless you only work on Twisted)
(add-hook 'python-mode-hook
(lambda () (flycheck-select-checker 'python-twistedchecker)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment