Move python-check-command into file local hook

This commit is contained in:
Evie Litherland-Smith 2025-02-24 10:33:20 +00:00
parent d782854337
commit 6c095f4403

10
init.el
View file

@ -1200,13 +1200,16 @@
(use-package python (use-package python
:hook ((python-base-mode . (lambda () :hook ((python-base-mode . (lambda ()
(set-fill-column 88)
(display-fill-column-indicator-mode +1)
(setq-local python-flymake-command (setq-local python-flymake-command
(cond (cond
((executable-find "ruff" t) '("ruff" "check" "--output-format=concise" "--stdin-filename=stdin" "-")) ((executable-find "ruff" t) '("ruff" "check" "--output-format=concise" "--stdin-filename=stdin" "-"))
((executable-find "flake8" t) '("flake8" "--max-line-length" "88" "-")) ((executable-find "flake8" t) '("flake8" "--max-line-length" "88" "-"))
(t '("pyflakes"))))))) (t '("pyflakes")))
python-check-command
(cond
((executable-find "basedpyright" t) "basedpyright")
((executable-find "mypy" t) "mypy --check-untyped-defs --warn-unreachable --show-error-codes --ignore-missing-imports")
(t "pyflakes"))))))
:custom :custom
(python-interpreter "python3") (python-interpreter "python3")
(python-shell-interpreter "python3") (python-shell-interpreter "python3")
@ -1215,7 +1218,6 @@
(python-indent-guess-indent-offset nil) (python-indent-guess-indent-offset nil)
(python-indent-offset 4) (python-indent-offset 4)
(python-indent-def-block-scale 1) (python-indent-def-block-scale 1)
(python-check-command "mypy --check-untyped-defs --warn-unreachable --show-error-codes --ignore-missing-imports")
:config :config
(setq python-ts-mode-hook python-mode-hook)) (setq python-ts-mode-hook python-mode-hook))