0

I'm using the latest Spacemacs with the Python layer. I'd like to turn off python-mypy in flycheck-mode, but the following in my ~/.spacemacs doesn't work:

(defun dotspacemacs/user-config ()
  (add-to-list 'flycheck-disabled-checkers 'python-mypy)
)

How do I turn it off?

1

From the doc:

flycheck-disabled-checkers is a variable defined in ‘flycheck.el’.
Its value is nil

  Automatically becomes buffer-local when set.
  This variable is safe as a file local variable if its value
  satisfies the predicate ‘flycheck-symbol-list-p’.
  You can customize this variable.

This variable is a buffer-local variable.

When you call add-to-list on it, it was set as locally. Check out the example call from ielm below.

buffer-local

One possible option is to customize it using the customize interface to let it set globally for you.


Edit:

  1. In fact you can set it in .dir-locals.el. This will set the variable for a lot of files ("directory local" variable is still file local, I might add). E.g. I tried setting the following (see below), and checkers are all disabled for every python file in the entire projectile dir.
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((python-mode . ((flycheck-disabled-checkers . (python-mypy python-flake8 python-pylint)))))
  1. How to customize & set it globally once and for all
  • Do C-h v (or SPC h d v, spacemacs only) and select flycheck-disabled-checkers.
  • Click customize in the sentence "You can customize this variable.".
  • In the interface, click INS to insert a value
  • Enter python-mypy as you wish
  • Click State and choose what you want
  • You can try out in the current session only
  • You can persist the customization for future use also
  • OR you can revert if you mess up
3
  • I don't suppose it's customizable in .dir-locals.el?
    – David Eyk
    Nov 10 '20 at 18:37
  • Also, could you expand on how I might use the customize interface to set it globally?
    – David Eyk
    Nov 10 '20 at 18:37
  • @DavidEyk Edited. HTH.
    – TerryTsao
    Nov 11 '20 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.