aboutsummaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'nvim')
-rw-r--r--nvim/init.lua1
-rw-r--r--nvim/lua/config/treesitter.lua1
-rw-r--r--nvim/lua/config/usercmds.lua31
-rw-r--r--nvim/lua/plugins/lsp.lua23
-rw-r--r--nvim/scripts/sonarqube.md28
-rwxr-xr-xnvim/scripts/sonarqube.sh13
6 files changed, 92 insertions, 5 deletions
diff --git a/nvim/init.lua b/nvim/init.lua
index c9bdaf1..e56561e 100644
--- a/nvim/init.lua
+++ b/nvim/init.lua
@@ -4,5 +4,6 @@ local keymaps = require("config.keymaps")
4keymaps.global() 4keymaps.global()
5 5
6require("config.autocmds") 6require("config.autocmds")
7require("config.usercmds")
7require("config.lazy") 8require("config.lazy")
8require("config.colorscheme") 9require("config.colorscheme")
diff --git a/nvim/lua/config/treesitter.lua b/nvim/lua/config/treesitter.lua
index 2bdfce5..f3024f0 100644
--- a/nvim/lua/config/treesitter.lua
+++ b/nvim/lua/config/treesitter.lua
@@ -12,6 +12,7 @@ M.languages = {
12 "make", 12 "make",
13 "markdown", 13 "markdown",
14 "markdown_inline", 14 "markdown_inline",
15 "po",
15 "prisma", 16 "prisma",
16 "python", 17 "python",
17 "typescript", 18 "typescript",
diff --git a/nvim/lua/config/usercmds.lua b/nvim/lua/config/usercmds.lua
new file mode 100644
index 0000000..e7dd220
--- /dev/null
+++ b/nvim/lua/config/usercmds.lua
@@ -0,0 +1,31 @@
1local function run_sonar()
2 local exe = vim.fn.exepath("sonar-scanner")
3
4 if exe == "" then
5 vim.notify("sonar-scanner nicht im PATH gefunden", vim.log.levels.ERROR)
6 return
7 end
8
9 if vim.fn.executable(exe) == 0 then
10 vim.notify("sonar-scanner ist nicht ausführbar", vim.log.levels.ERROR)
11 return
12 end
13
14 -- vim.cmd("!" .. exe)
15 vim.cmd("botright split | terminal " .. exe)
16 vim.cmd("norm G")
17end
18
19local function load_sonar_issues()
20 local cmd = vim.fn.stdpath("config") .. "/scripts/sonarqube.sh"
21
22 vim.fn.setqflist({}, " ", {
23 title = "SonarQube Issues",
24 lines = vim.fn.systemlist(cmd),
25 })
26
27 vim.cmd("copen")
28end
29
30vim.api.nvim_create_user_command("SonarScan", run_sonar, {})
31vim.api.nvim_create_user_command("SonarIssues", load_sonar_issues, {})
diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua
index 4640678..03a6be0 100644
--- a/nvim/lua/plugins/lsp.lua
+++ b/nvim/lua/plugins/lsp.lua
@@ -56,6 +56,10 @@ return {
56 capabilities = capabilities, 56 capabilities = capabilities,
57 } 57 }
58 58
59 vim.lsp.config.jsonls = {
60 capabilities = capabilities,
61 }
62
59 vim.lsp.config.vtsls = { 63 vim.lsp.config.vtsls = {
60 capabilities = capabilities, 64 capabilities = capabilities,
61 settings = { 65 settings = {
@@ -73,6 +77,14 @@ return {
73 variableTypes = { enabled = false }, 77 variableTypes = { enabled = false },
74 }, 78 },
75 }, 79 },
80 javascript = {
81 suggest = {
82 completeFunctionCalls = true,
83 },
84 inlayHints = {
85 parameterNames = { enabled = "all" },
86 },
87 },
76 }, 88 },
77 } 89 }
78 90
@@ -95,11 +107,12 @@ return {
95 107
96 vim.lsp.enable({ 108 vim.lsp.enable({
97 "basedpyright", -- npm install -g basedpyright, brew install basedpyright 109 "basedpyright", -- npm install -g basedpyright, brew install basedpyright
98 "bashls", -- npm install -g bash-language-server, pkg install hs-ShellCheck 110 "bashls", -- npm install -g bash-language-server, pkg install hs-ShellCheck
99 "clangd", -- pkg install llvm 111 "clangd", -- pkg install llvm
100 "lua_ls", -- pkg install lua-language-server 112 "jsonls", -- npm install -g vscode-langservers-extracted
101 "prismals", -- npm install -g @prisma/language-server 113 "lua_ls", -- pkg install lua-language-server
102 "vtsls", -- npm install -g @vtsls/language-server 114 "prismals", -- npm install -g @prisma/language-server
115 "vtsls", -- npm install -g @vtsls/language-server
103 }) 116 })
104 end, 117 end,
105 }, 118 },
diff --git a/nvim/scripts/sonarqube.md b/nvim/scripts/sonarqube.md
new file mode 100644
index 0000000..d276053
--- /dev/null
+++ b/nvim/scripts/sonarqube.md
@@ -0,0 +1,28 @@
1# Installieren
2
3```sh
4brew install sonar-scanner
5```
6
7# Token erstellen
8
91. Mit VPN verbinden.
102. Bei [Sonarqube] anmelden.
113. Auf "Account" -> "My Account" -> "Security" klicken
124. Einen neuen Token erstellen:
13 Name: "command-line"
14 Type: "User Token"
15 Expires in: "1 year"
165. Token und Host-URL in `/opt/homebrew/etc/sonar-scanner.properties` einfügen:
17```conf
18sonar.token=<token>
19sonar.host.url=https://sonarqube.dev.up2parts.com
20```
21
22# Sonarqube ausführen
23
24Im Projektverzeichnis `sonar-scaner` ausführen.
25Sonarqube muss für das Projekt mit einer Datei `sonar-project.properties` konfiguriert sein.
26
27[Sonarqube]: https://sonarqube.dev.up2parts.com/
28
diff --git a/nvim/scripts/sonarqube.sh b/nvim/scripts/sonarqube.sh
new file mode 100755
index 0000000..ef1be89
--- /dev/null
+++ b/nvim/scripts/sonarqube.sh
@@ -0,0 +1,13 @@
1#!/bin/sh
2
3set -eu
4
5SONAR_TOKEN=$(awk -F= '/^sonar.token=/ {print $2}' /opt/homebrew/etc/sonar-scanner.properties)
6SONAR_HOST_URL=$(awk -F= '/^sonar.host.url=/ {print $2}' /opt/homebrew/etc/sonar-scanner.properties)
7PROJECT_KEY=$(awk -F= '/^sonar.projectKey=/ {print $2}' ./sonar-project.properties)
8
9curl -s \
10 -u "$SONAR_TOKEN:" \
11 "$SONAR_HOST_URL/api/issues/search?componentKeys=$PROJECT_KEY&statuses=OPEN" |
12 jq -r '.issues[] | "\(.component | sub("^[^:]+:"; "")):\(.line // 1): [\(.severity)] \(.message | gsub("\n"; " ")) (\(.author))"'
13