#StackBounty: #python #flycheck #lsp How to ignore specific flycheck warning messages for Python in lsp-mode?

Bounty: 50

My goal is to configure lsp in order to ignore warning messages for flycheck in Python version.

When lsp is not in use, flycheck reads from my ~/.pylintrc file in order to ignore warning messsages. But when I enable lsp-mode it does not ignore the warning messages that I set in ~/.pylintrc file.

minimal.el:

(defun flycheck-python-setup ()
  (flycheck-mode))
(require 'flycheck)
(require 'flycheck-mypy)
(add-hook 'after-init-hook #'global-flycheck-mode)
(add-hook 'after-init-hook #'global-flycheck-mode)
(add-to-list 'flycheck-disabled-checkers 'python-flake8)
(add-hook 'python-mode-hook
          (lambda ()
            (setq flycheck-python-pylint-executable "~/venv/bin/pylint")
            (setq flycheck-pylintrc "~/.pylintrc")
            (setq indent-tabs-mode  nil
                  python-indent-offset  4
                  tab-width         4)
            (let ((inhibit-message  t))
              )))
(use-package python :ensure nil)
(add-hook 'python-mode-hook #'flycheck-python-setup)
(flycheck-add-next-checker 'python-flake8 'python-pylint 'python-mypy)

Having following lines in order to enable lsp-mode, changes the result for helm-flycheck.

(add-hook 'python-mode-hook 'lsp)
(add-hook 'python-mode-hook #'lsp-deferred)

❯ cat ~/.pylintrc
disable=D100,  C0305, C0303, W291,  C0111, R0801, W0703, C0103,

Related: flycheck cannot find module for pylint, https://www.reddit.com/r/emacs/comments/b5lvx6/how_do_i_force_lspui_to_use_flake8/

(add-hook 'python-mode-hook
  (lambda ()
    (setq flycheck-python-pylint-executable "<your path to>/pylint")
    (setq flycheck-pylintrc "/home/tools/.pylintrc"))) 


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.