diff options
author | Luc Sinet <[email protected]> | 2021-07-17 00:30:38 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-16 18:30:38 -0400 |
commit | 836286798e959fbaa43bd4502561cf85aea537c9 (patch) | |
tree | 821f5c459fb056c619aab9f34d802be8776a1cac /lua/lang/python.lua | |
parent | fe48ed9ef9de8da8b9fbf7f82f8e0af1758581a4 (diff) |
[Feature] add linter support (#982)
Diffstat (limited to 'lua/lang/python.lua')
-rw-r--r-- | lua/lang/python.lua | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/lua/lang/python.lua b/lua/lang/python.lua index 3bab555a..b4f74a6a 100644 --- a/lua/lang/python.lua +++ b/lua/lang/python.lua @@ -19,6 +19,11 @@ M.config = function() exe = "yapf", args = {}, }, + linters = { + "flake8", + "pylint", + "mypy", + }, } end @@ -40,41 +45,9 @@ M.format = function() end M.lint = function() - if require("lv-utils").check_lsp_client_active "efm" then - return - end - local python_arguments = {} - - local flake8 = { - LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -", - lintStdin = true, - lintFormats = { "%f:%l:%c: %m" }, + require("lint").linters_by_ft = { + python = O.lang.python.linters, } - - local isort = { formatCommand = "isort --quiet -", formatStdin = true } - - if O.lang.python.linter == "flake8" then - table.insert(python_arguments, flake8) - end - - if O.lang.python.isort then - table.insert(python_arguments, isort) - end - - if not require("lv-utils").check_lsp_client_active "efm" then - require("lspconfig").efm.setup { - cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" }, - init_options = { documentFormatting = true, codeAction = false }, - root_dir = require("lspconfig").util.root_pattern(".git/", "requirements.txt"), - filetypes = { "python" }, - settings = { - rootMarkers = { ".git/", "requirements.txt" }, - languages = { - python = python_arguments, - }, - }, - } - end end M.lsp = function() |