From adfe7ed302fa30205d4c63d8207228e01c6833bf Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Fri, 2 Dec 2022 17:06:31 -0800 Subject: [PATCH] Enabling all the Python checkers! --- ha-programming-python.org | 17 +++++++++++++---- ha-programming.org | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ha-programming-python.org b/ha-programming-python.org index 06f196d..5532562 100644 --- a/ha-programming-python.org +++ b/ha-programming-python.org @@ -38,11 +38,12 @@ While Emacs supplies a Python editing environment, we’ll still use =use-packag #+begin_src emacs-lisp (use-package python - :after projectile + :after projectile flycheck :mode ("[./]flake8\\'" . conf-mode) :mode ("/Pipfile\\'" . conf-mode) :init - (setq python-indent-guess-indent-offset-verbose nil) + (setq python-indent-guess-indent-offset-verbose nil + flycheck-flake8-maximum-line-length 120) :config (when (and (executable-find "python3") (string= python-shell-interpreter "python")) @@ -51,10 +52,18 @@ While Emacs supplies a Python editing environment, we’ll still use =use-packag ;; While `setup.py' and `requirements.txt' are already added, I often ;; create these files for my Python projects: (add-to-list 'projectile-project-root-files "requirements-dev.txt") - (add-to-list 'projectile-project-root-files "requirements-test.txt")) + (add-to-list 'projectile-project-root-files "requirements-test.txt") + + (flycheck-add-next-checker 'python-pylint 'python-pycompile 'append)) #+end_src + +Note: Install the following checks: +#+begin_src sh + pip install flake8 pylint pyright mypy pycompile +#+end_src +Or better yet, add those to the =requirements-dev.txt= file. ** Virtual Environment -For a local virtual machine, simply put the following in your =.envrc= file: +For a local virtual machine, put the following in your =.envrc= file: #+begin_src conf layout_python3 #+end_src diff --git a/ha-programming.org b/ha-programming.org index 421d104..f982797 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -69,7 +69,8 @@ Why use [[https://www.flycheck.org/][flycheck]] over the built-in =flymake=? Spe (defun flycheck-enable-checker () "Not sure why flycheck disables working checkers." (interactive) - (call-interactively 'flycheck-disable-checker 4)) + (let (( current-prefix-arg '(4))) ; C-u + (call-interactively 'flycheck-disable-checker))) (flymake-mode -1) (global-flycheck-mode)