aboutsummaryrefslogtreecommitdiff
path: root/nvim/lua/plugins/lint.lua
blob: f1d3b785341698c81fbf7de828a9d779a6978e15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- Verfügbare Linter: https://github.com/mfussenegger/nvim-lint/tree/master/lua/lint/linters
--
-- Hier gehören nur Linter hinein, die kein Sprachserver ohnehin schon meldet:
-- shellcheck läuft in bashls, clang-tidy in clangd, ansible-lint in ansiblels.

local ruff = { "ruff" } -- bereits als Formatter installiert, siehe plugins/format.lua
local zsh = { "zsh" } -- kein zusätzliches Werkzeug: ruft `zsh --no-exec` auf

return {
  "mfussenegger/nvim-lint",
  event = { "BufReadPre", "BufNewFile" },
  config = function()
    local lint = require("lint")

    lint.linters_by_ft = {
      -- ergänzt die Typprüfung von basedpyright um die Lint-Regeln (F, E, UP, B ...)
      python = ruff,
      -- Syntaxprüfung ohne Ausführung; bashls deckt nur sh und bash ab
      zsh = zsh,
    }

    vim.api.nvim_create_autocmd({ "BufReadPost", "BufWritePost", "InsertLeave" }, {
      callback = function()
        lint.try_lint()
      end,
    })
  end,
}