diff options
| -rw-r--r-- | nvim/init.lua | 1 | ||||
| -rw-r--r-- | nvim/lua/config/treesitter.lua | 1 | ||||
| -rw-r--r-- | nvim/lua/config/usercmds.lua | 31 | ||||
| -rw-r--r-- | nvim/lua/plugins/lsp.lua | 13 | ||||
| -rw-r--r-- | nvim/scripts/sonarqube.md | 28 | ||||
| -rwxr-xr-x | nvim/scripts/sonarqube.sh | 13 |
6 files changed, 87 insertions, 0 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") | |||
| 4 | keymaps.global() | 4 | keymaps.global() |
| 5 | 5 | ||
| 6 | require("config.autocmds") | 6 | require("config.autocmds") |
| 7 | require("config.usercmds") | ||
| 7 | require("config.lazy") | 8 | require("config.lazy") |
| 8 | require("config.colorscheme") | 9 | require("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 @@ | |||
| 1 | local 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") | ||
| 17 | end | ||
| 18 | |||
| 19 | local 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") | ||
| 28 | end | ||
| 29 | |||
| 30 | vim.api.nvim_create_user_command("SonarScan", run_sonar, {}) | ||
| 31 | vim.api.nvim_create_user_command("SonarIssues", load_sonar_issues, {}) | ||
diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 3d53350..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 | ||
| @@ -97,6 +109,7 @@ return { | |||
| 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 |
| 112 | "jsonls", -- npm install -g vscode-langservers-extracted | ||
| 100 | "lua_ls", -- pkg install lua-language-server | 113 | "lua_ls", -- pkg install lua-language-server |
| 101 | "prismals", -- npm install -g @prisma/language-server | 114 | "prismals", -- npm install -g @prisma/language-server |
| 102 | "vtsls", -- npm install -g @vtsls/language-server | 115 | "vtsls", -- npm install -g @vtsls/language-server |
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 | ||
| 4 | brew install sonar-scanner | ||
| 5 | ``` | ||
| 6 | |||
| 7 | # Token erstellen | ||
| 8 | |||
| 9 | 1. Mit VPN verbinden. | ||
| 10 | 2. Bei [Sonarqube] anmelden. | ||
| 11 | 3. Auf "Account" -> "My Account" -> "Security" klicken | ||
| 12 | 4. Einen neuen Token erstellen: | ||
| 13 | Name: "command-line" | ||
| 14 | Type: "User Token" | ||
| 15 | Expires in: "1 year" | ||
| 16 | 5. Token und Host-URL in `/opt/homebrew/etc/sonar-scanner.properties` einfügen: | ||
| 17 | ```conf | ||
| 18 | sonar.token=<token> | ||
| 19 | sonar.host.url=https://sonarqube.dev.up2parts.com | ||
| 20 | ``` | ||
| 21 | |||
| 22 | # Sonarqube ausführen | ||
| 23 | |||
| 24 | Im Projektverzeichnis `sonar-scaner` ausführen. | ||
| 25 | Sonarqube 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 | |||
| 3 | set -eu | ||
| 4 | |||
| 5 | SONAR_TOKEN=$(awk -F= '/^sonar.token=/ {print $2}' /opt/homebrew/etc/sonar-scanner.properties) | ||
| 6 | SONAR_HOST_URL=$(awk -F= '/^sonar.host.url=/ {print $2}' /opt/homebrew/etc/sonar-scanner.properties) | ||
| 7 | PROJECT_KEY=$(awk -F= '/^sonar.projectKey=/ {print $2}' ./sonar-project.properties) | ||
| 8 | |||
| 9 | curl -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 | |||
