emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Flymake refactored


From: Mark Oteiza
Subject: Re: Flymake refactored
Date: Fri, 06 Oct 2017 09:04:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux)

Lele Gaifax <address@hidden> writes:

> Stefan Monnier <address@hidden> writes:
>
>> I think the Python backend would naturally belong in python.el
>
> I'm attaching what I'm currently testing out: how should I proceed to
> contribute it?

A small patch on top of it: this facilitates configuring the checker to
instead be flake8, which is a wrapper around a few checkers, including pyflakes

http://flake8.pycqa.org/en/latest/
https://pypi.python.org/pypi/flake8

To use flake8, the command should be '("flake8" "-"), the output regexp

  ^stdin:\(?1:[0-9]+\):\(?:\(?2:[0-9]+\):\)? \(?3:.*\)$

and lifting from flycheck, the alist

  '(("^E9.*$" . :error)
    ("^F82.*$" . :error)
    ("^F83.*$" . :error)
    ("^D.*$" . :info)
    ("^N.*$" . :info))


--- lisp/progmodes/python.el    2017-10-06 08:55:36.328201056 -0400
+++ lisp/progmodes/python2.el   2017-10-06 08:56:18.424137623 -0400
@@ -5160,9 +5160,9 @@
   :group 'python-flymake
   :type 'regexp)
 
-(defcustom python-flymake-warn-msg-regexp
-  "\\(^redefinition\\|.*unused.*\\|used$\\)"
-  "The regexp used to discriminate warnings from errors."
+(defcustom python-flymake-msg-alist
+  '(("\\(^redefinition\\|.*unused.*\\|used$\\)" . :warning))
+  "Alist used to associate messages with their types."
   :group 'python-flymake
   :type 'regexp)
 
@@ -5204,9 +5204,10 @@
                                            (and (match-string 2)
                                                 (string-to-number
                                                  (match-string 2))))
-                        for type = (if (string-match
-                                        python-flymake-warn-msg-regexp msg)
-                                       :warning :error)
+                        for type = (or (assoc-default msg
+                                                      python-flymake-msg-alist
+                                                      #'string-match)
+                                       :error)
                         collect (flymake-make-diagnostic
                                  source beg end type msg)
                         into diags



reply via email to

[Prev in Thread] Current Thread [Next in Thread]