From 0d6b860e499a9b927bc1f6fd564db2d381252042 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Tue, 21 Nov 2023 16:33:52 +1100 Subject: [PATCH 01/56] ci: add lls-check --- .gitignore | 1 + scripts/lls-check | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 .gitignore create mode 100755 scripts/lls-check diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..ac28f37213a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/lls-check/ diff --git a/scripts/lls-check b/scripts/lls-check new file mode 100755 index 00000000000..9fcb00214d9 --- /dev/null +++ b/scripts/lls-check @@ -0,0 +1,30 @@ +#!/bin/sh + +# Performs a lua-language-server check on all files. +# lls-check/check.json will be produced on any issues, returning 1. + +rm -rf lls-check +mkdir lls-check + +OUT=$(lua-language-server --checklevel=Information --check . --logpath=lls-check --loglevel=error) +echo "${OUT}" + +RC=$? +if [ $RC -ne 0 ]; then + echo "failed with RC=$RC" + exit $RC +fi + +case "${OUT}" in + *Diagnosis\ completed*) + if [ -f "lls-check/check.json" ]; then + exit 1 + else + exit 0 + fi + ;; + *) + exit 1 + ;; +esac + From a2902e51594a8246d63437f07f7dd2efb25b78a6 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Tue, 21 Nov 2023 16:47:17 +1100 Subject: [PATCH 02/56] ci: add lls-check to ci.yml --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c88c11c4bd5..e896c6f96f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,3 +42,17 @@ jobs: - name: doc-comments run: ./scripts/doc-comments.sh + + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: deps + run: | + sudo add-apt-repository universe + sudo apt install lua-language-server -y + + - name: lls-check + run: | + scripts/lls-check From 78bfdf83bdc8b84145e37d337874cb15357b4d57 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 25 Nov 2023 16:47:30 +1100 Subject: [PATCH 03/56] ci: download lua-language-server binary --- scripts/lls-check | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/scripts/lls-check b/scripts/lls-check index 9fcb00214d9..3aaaab23501 100755 --- a/scripts/lls-check +++ b/scripts/lls-check @@ -2,12 +2,28 @@ # Performs a lua-language-server check on all files. # lls-check/check.json will be produced on any issues, returning 1. +# Outputs check.json to stdout, all messages to stderr, to allow jq etc. -rm -rf lls-check -mkdir lls-check +VER_LLS="3.7.3" -OUT=$(lua-language-server --checklevel=Information --check . --logpath=lls-check --loglevel=error) -echo "${OUT}" +DIR_SRC="${PWD}" +DIR_OUT="${DIR_SRC}/lls-out" +DIR_LLS="/tmp/lls" + +# clear output +rm -rf "${DIR_OUT}" +mkdir "${DIR_OUT}" + +if [ ! -d "${DIR_LLS}" ]; then + # download lua-language-server binaries + mkdir -p "${DIR_LLS}" + curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${VER_LLS}/lua-language-server-${VER_LLS}-linux-x64.tar.gz" | tar zx --directory "${DIR_LLS}" +fi + +# execute from within the lua-language-server directory as it expects specific file locations +cd "${DIR_LLS}" +OUT=$("${DIR_LLS}/bin/lua-language-server" --checklevel=Information --check "${DIR_SRC}" --logpath="${DIR_OUT}" --loglevel=error) +echo "${OUT}" >&2 RC=$? if [ $RC -ne 0 ]; then @@ -15,9 +31,11 @@ if [ $RC -ne 0 ]; then exit $RC fi +# any output is a fail case "${OUT}" in - *Diagnosis\ completed*) - if [ -f "lls-check/check.json" ]; then + *Diagnosis\ complete*) + if [ -f "${DIR_OUT}/check.json" ]; then + cat "${DIR_OUT}/check.json" exit 1 else exit 0 From df807c434b3953c878cdec7202f0a303707a0a6f Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 25 Nov 2023 16:48:48 +1100 Subject: [PATCH 04/56] ci: download lua-language-server binary --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e896c6f96f1..9b242c8f624 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,11 +48,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: deps - run: | - sudo add-apt-repository universe - sudo apt install lua-language-server -y - - name: lls-check run: | scripts/lls-check From 5a01aa802396a0a56b04e787a11373b20535c37a Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 25 Nov 2023 16:50:23 +1100 Subject: [PATCH 05/56] ci: dummy failure to test --- lua/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index ce9837e9605..48771b21ed2 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -37,7 +37,7 @@ function M.change_root(path, bufnr) end -- don't find inexistent - if vim.fn.filereadable(path) == 0 then + if foo.fn.filereadable(path) == 0 then return end From 1f2e52c39a5de181e3d65820a5d73218aa6a892f Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 25 Nov 2023 16:51:10 +1100 Subject: [PATCH 06/56] Revert "ci: dummy failure to test" This reverts commit 2bc43bad430209e32a5049a16c56710c4f6e2f7b. --- lua/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 48771b21ed2..ce9837e9605 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -37,7 +37,7 @@ function M.change_root(path, bufnr) end -- don't find inexistent - if foo.fn.filereadable(path) == 0 then + if vim.fn.filereadable(path) == 0 then return end From 04aa5a2da31e174a4ab9fbc87151991d0114cc1b Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 25 Nov 2023 16:51:48 +1100 Subject: [PATCH 07/56] ci: ignore lls-out --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ac28f37213a..10eabef981c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/lls-check/ +/lls-out/ From 8d9b108f6abdd23afc39a61b6b181ae62ff78cb2 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 25 Nov 2023 16:53:45 +1100 Subject: [PATCH 08/56] ci: better name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b242c8f624..5ebf0b3af51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: lls-check + - name: lua-language-server --check run: | scripts/lls-check From eb856a50ca3eb90ae300fe9d7cb2fb42b6283d9b Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 25 Nov 2023 17:14:55 +1100 Subject: [PATCH 09/56] ci: shellcheck nits --- scripts/lls-check | 5 +++-- scripts/update-help.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/lls-check b/scripts/lls-check index 3aaaab23501..7efe1421a81 100755 --- a/scripts/lls-check +++ b/scripts/lls-check @@ -21,11 +21,12 @@ if [ ! -d "${DIR_LLS}" ]; then fi # execute from within the lua-language-server directory as it expects specific file locations -cd "${DIR_LLS}" +cd "${DIR_LLS}" || exit OUT=$("${DIR_LLS}/bin/lua-language-server" --checklevel=Information --check "${DIR_SRC}" --logpath="${DIR_OUT}" --loglevel=error) +RC=$? + echo "${OUT}" >&2 -RC=$? if [ $RC -ne 0 ]; then echo "failed with RC=$RC" exit $RC diff --git a/scripts/update-help.sh b/scripts/update-help.sh index 522a5a44555..b88de2250be 100755 --- a/scripts/update-help.sh +++ b/scripts/update-help.sh @@ -38,7 +38,7 @@ sed -i -e "/${begin}/,/${end}/{ /${begin}/{p; r /tmp/DEFAULT_ON_ATTACH.lua # help human echo > /tmp/DEFAULT_ON_ATTACH.help sed -E "s/^ *vim.keymap.set\('n', '(.*)',.*api(.*),.*opts\('(.*)'.*$/'\`\1\`' '\3' '|nvim-tree-api\2()|'/g -" /tmp/DEFAULT_ON_ATTACH.lua | while read line +" /tmp/DEFAULT_ON_ATTACH.lua | while read -r line do eval "printf '%-17.17s %-26.26s %s\n' ${line}" >> /tmp/DEFAULT_ON_ATTACH.help done From 931efb3708a5ba3a03bf06041597da28687c68e4 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 26 Nov 2023 13:22:30 +1100 Subject: [PATCH 10/56] ci: add luals libs and tidy --- .gitignore | 2 +- .luarc.json | 6 ++++++ scripts/{lls-check => luals-check} | 7 +++---- 3 files changed, 10 insertions(+), 5 deletions(-) rename scripts/{lls-check => luals-check} (83%) diff --git a/.gitignore b/.gitignore index 10eabef981c..5cd78185b8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/lls-out/ +/luals-out/ diff --git a/.luarc.json b/.luarc.json index 6ae9cf62374..77434c8df9c 100644 --- a/.luarc.json +++ b/.luarc.json @@ -1,6 +1,12 @@ { "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", "runtime.version" : "Lua 5.1", + "workspace": { + "library": [ + "$VIMRUNTIME", + "${3rd}/luv/library" + ] + }, "diagnostics": { "globals": [ "vim" diff --git a/scripts/lls-check b/scripts/luals-check similarity index 83% rename from scripts/lls-check rename to scripts/luals-check index 7efe1421a81..4a0573871dc 100755 --- a/scripts/lls-check +++ b/scripts/luals-check @@ -1,13 +1,13 @@ #!/bin/sh # Performs a lua-language-server check on all files. -# lls-check/check.json will be produced on any issues, returning 1. -# Outputs check.json to stdout, all messages to stderr, to allow jq etc. +# luals-out/check.json will be produced on any issues, returning 1. +# Outputs only check.json to stdout, all other messages to stderr, to allow jq etc. VER_LLS="3.7.3" DIR_SRC="${PWD}" -DIR_OUT="${DIR_SRC}/lls-out" +DIR_OUT="${DIR_SRC}/luals-out" DIR_LLS="/tmp/lls" # clear output @@ -21,7 +21,6 @@ if [ ! -d "${DIR_LLS}" ]; then fi # execute from within the lua-language-server directory as it expects specific file locations -cd "${DIR_LLS}" || exit OUT=$("${DIR_LLS}/bin/lua-language-server" --checklevel=Information --check "${DIR_SRC}" --logpath="${DIR_OUT}" --loglevel=error) RC=$? From 4e9ee61aa27e9de7da13fd02bde24411bf5749ae Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 26 Nov 2023 13:38:41 +1100 Subject: [PATCH 11/56] ci: tidy --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ebf0b3af51..cc758a1b6e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,4 +50,4 @@ jobs: - name: lua-language-server --check run: | - scripts/lls-check + scripts/luals-check From 48494be4b8bad68cd7cb0415c7ab626e7b189114 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 26 Nov 2023 13:46:50 +1100 Subject: [PATCH 12/56] ci: add neovim 0.9.4 --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc758a1b6e6..9f788678828 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,11 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: v0.9.4 + - name: lua-language-server --check run: | scripts/luals-check From 10de5c28a34a7b0869828d6ad5cd4b7a3cd0a3da Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 26 Nov 2023 13:56:19 +1100 Subject: [PATCH 13/56] ci: add ci neovim 0.9.4 to lib path --- .luarc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.luarc.json b/.luarc.json index 77434c8df9c..950b1777766 100644 --- a/.luarc.json +++ b/.luarc.json @@ -4,6 +4,7 @@ "workspace": { "library": [ "$VIMRUNTIME", + "/home/runner/nvim-v0.9.4/share/nvim/runtime", "${3rd}/luv/library" ] }, From fea0f048393280f8716032f960ea7324c6320269 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 26 Nov 2023 13:57:00 +1100 Subject: [PATCH 14/56] ci: dummy failure to test --- .luarc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.luarc.json b/.luarc.json index 950b1777766..97d321ca992 100644 --- a/.luarc.json +++ b/.luarc.json @@ -10,7 +10,7 @@ }, "diagnostics": { "globals": [ - "vim" + "foo" ], "neededFileStatus": { "ambiguity-1": "Any", From c12a3af901215f748297feed9df08d3398429b11 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 26 Nov 2023 14:05:34 +1100 Subject: [PATCH 15/56] Revert "ci: dummy failure to test" This reverts commit 45987335d81ec65fecc6636b339671a9a9fcdd97. --- .luarc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.luarc.json b/.luarc.json index 97d321ca992..950b1777766 100644 --- a/.luarc.json +++ b/.luarc.json @@ -10,7 +10,7 @@ }, "diagnostics": { "globals": [ - "foo" + "vim" ], "neededFileStatus": { "ambiguity-1": "Any", From a1e293f98c0e3b655bf453ef3e274084bf47c6e5 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 26 Nov 2023 14:05:44 +1100 Subject: [PATCH 16/56] Revert "ci: add ci neovim 0.9.4 to lib path" This reverts commit 4f397d6ea8bbdf6e808f9dc9db5ecbae291d8cd4. --- .luarc.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.luarc.json b/.luarc.json index 950b1777766..77434c8df9c 100644 --- a/.luarc.json +++ b/.luarc.json @@ -4,7 +4,6 @@ "workspace": { "library": [ "$VIMRUNTIME", - "/home/runner/nvim-v0.9.4/share/nvim/runtime", "${3rd}/luv/library" ] }, From 820b7b386f93f373eba58c8ccb6433e3257ca6db Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 26 Nov 2023 14:05:53 +1100 Subject: [PATCH 17/56] Revert "ci: add neovim 0.9.4" This reverts commit 46fd1b368d27a1892b55381691723db3b30a7527. --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f788678828..cc758a1b6e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,11 +48,6 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: rhysd/action-setup-vim@v1 - with: - neovim: true - version: v0.9.4 - - name: lua-language-server --check run: | scripts/luals-check From b5de0c18466b71f4db93b1f91d53c7799e67361b Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 9 Dec 2023 13:57:26 +1100 Subject: [PATCH 18/56] ci: action downloads and installs luals --- .github/workflows/ci.yml | 11 ++++++++++- scripts/luals-check | 17 ++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc758a1b6e6..1fd8cd611a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,9 +45,18 @@ jobs: check: runs-on: ubuntu-latest + + env: + LUALS_VERSION: 3.7.3 + steps: - uses: actions/checkout@v3 + - name: install + run: | + mkdir -p luals + curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${LUALS_VERSION}/lua-language-server-${LUALS_VERSION}-linux-x64.tar.gz" | tar zx --directory luals + - name: lua-language-server --check run: | - scripts/luals-check + PATH="luals/bin:${PATH}" scripts/luals-check diff --git a/scripts/luals-check b/scripts/luals-check index 4a0573871dc..f841fedff8b 100755 --- a/scripts/luals-check +++ b/scripts/luals-check @@ -4,24 +4,15 @@ # luals-out/check.json will be produced on any issues, returning 1. # Outputs only check.json to stdout, all other messages to stderr, to allow jq etc. -VER_LLS="3.7.3" - -DIR_SRC="${PWD}" -DIR_OUT="${DIR_SRC}/luals-out" -DIR_LLS="/tmp/lls" +DIR_SRC="lua" +DIR_OUT="luals-out" # clear output rm -rf "${DIR_OUT}" mkdir "${DIR_OUT}" -if [ ! -d "${DIR_LLS}" ]; then - # download lua-language-server binaries - mkdir -p "${DIR_LLS}" - curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${VER_LLS}/lua-language-server-${VER_LLS}-linux-x64.tar.gz" | tar zx --directory "${DIR_LLS}" -fi - -# execute from within the lua-language-server directory as it expects specific file locations -OUT=$("${DIR_LLS}/bin/lua-language-server" --checklevel=Information --check "${DIR_SRC}" --logpath="${DIR_OUT}" --loglevel=error) +# execute inside lua to prevent luals itself from being checked +OUT=$(lua-language-server --check "${DIR_SRC}" --configpath="${PWD}/.luarc.json" --checklevel=Information --logpath="${DIR_OUT}" --loglevel=error) RC=$? echo "${OUT}" >&2 From b60ea9c0c2ab5385be329a4907163888bcae2b0a Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 9 Dec 2023 13:59:22 +1100 Subject: [PATCH 19/56] ci: remove workspaces from luals --- .luarc.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.luarc.json b/.luarc.json index 77434c8df9c..6ae9cf62374 100644 --- a/.luarc.json +++ b/.luarc.json @@ -1,12 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", "runtime.version" : "Lua 5.1", - "workspace": { - "library": [ - "$VIMRUNTIME", - "${3rd}/luv/library" - ] - }, "diagnostics": { "globals": [ "vim" From edbf5012a2cb49612e6f8f025d8c0b395f35057e Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 9 Dec 2023 14:00:50 +1100 Subject: [PATCH 20/56] ci: consistent script naming --- scripts/{luals-check => luals-check.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{luals-check => luals-check.sh} (100%) diff --git a/scripts/luals-check b/scripts/luals-check.sh similarity index 100% rename from scripts/luals-check rename to scripts/luals-check.sh From 2356e3d77c38a59a37ad0eb274e61db4cb28b1f5 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 9 Dec 2023 14:11:06 +1100 Subject: [PATCH 21/56] ci: add quality to contributing --- CONTRIBUTING.md | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ceeec034747..22d5f9e05ec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,31 +4,51 @@ Thank you for contributing. See [Development](https://github.com/nvim-tree/nvim-tree.lua/wiki/Development) for environment setup, tips and tools. +# Quality + +The following quality checks are mandatory and are performed during CI: + ## Styling and formatting Code is formatted using luacheck, and linted using stylua. -You can install these with: +You may install these via your package manager or with: ```bash luarocks install luacheck cargo install stylua ``` +Run: +```sh +stylua lua +luacheck lua +``` + You can setup the git hooks by running `scripts/setup-hooks.sh`. -## Adding new actions +## Check + +[luals](https://luals.github.io) check is run with: + +```sh +scripts/luals-check.sh +``` + +Requires `lua-language-server` on your path. + +# Adding new actions To add a new action, add a file in `actions/name-of-the-action.lua`. You should export a `setup` function if some configuration is needed. Once you did, you should run the `scripts/update-help.sh`. -## Documentation +# Documentation When adding new options, you should declare the defaults in the main `nvim-tree.lua` file. Once you did, you should run the `scripts/update-help.sh`. Documentation for options should also be added to `nvim-tree-opts` in `doc/nvim-tree-lua.txt` -## Pull Request +# Pull Request Please reference any issues in the description e.g. "resolves #1234". From 747854a9690c14689e674a6dc7c86c0c9b04ff29 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 9 Dec 2023 14:15:19 +1100 Subject: [PATCH 22/56] ci: consistent script naming --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fd8cd611a3..fc2a4482de9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,4 +59,4 @@ jobs: - name: lua-language-server --check run: | - PATH="luals/bin:${PATH}" scripts/luals-check + PATH="luals/bin:${PATH}" scripts/luals-check.sh From 4d836e8ca03a2de86f3b63091bb15cce354a8630 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 30 Dec 2023 15:07:27 +1100 Subject: [PATCH 23/56] ci: add lsp to diagnostics --- .github/workflows/ci.yml | 2 +- .luarc.json | 6 ++++++ lua/nvim-tree/diagnostics.lua | 3 --- scripts/luals-check.sh | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc2a4482de9..ca6dec54a06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,4 +59,4 @@ jobs: - name: lua-language-server --check run: | - PATH="luals/bin:${PATH}" scripts/luals-check.sh + VIMRUNTIME=/home/runner/nvim-v0.9.4 PATH="luals/bin:${PATH}" scripts/luals-check.sh diff --git a/.luarc.json b/.luarc.json index 6ae9cf62374..2f25d795511 100644 --- a/.luarc.json +++ b/.luarc.json @@ -1,7 +1,13 @@ { "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", "runtime.version" : "Lua 5.1", + "workspace": { + "library": [ + "$VIMRUNTIME/lua/vim/lsp" + ] + }, "diagnostics": { + "libraryFiles": "Disable", "globals": [ "vim" ], diff --git a/lua/nvim-tree/diagnostics.lua b/lua/nvim-tree/diagnostics.lua index 6ca13c9c067..6d0e1354149 100644 --- a/lua/nvim-tree/diagnostics.lua +++ b/lua/nvim-tree/diagnostics.lua @@ -4,9 +4,6 @@ local log = require "nvim-tree.log" local M = {} ----TODO add "$VIMRUNTIME" to "workspace.library" and use the @enum instead of this integer ----@alias lsp.DiagnosticSeverity integer - ---COC severity level strings to LSP severity levels ---@enum COC_SEVERITY_LEVELS local COC_SEVERITY_LEVELS = { diff --git a/scripts/luals-check.sh b/scripts/luals-check.sh index f841fedff8b..9d8ddc7459a 100755 --- a/scripts/luals-check.sh +++ b/scripts/luals-check.sh @@ -12,7 +12,7 @@ rm -rf "${DIR_OUT}" mkdir "${DIR_OUT}" # execute inside lua to prevent luals itself from being checked -OUT=$(lua-language-server --check "${DIR_SRC}" --configpath="${PWD}/.luarc.json" --checklevel=Information --logpath="${DIR_OUT}" --loglevel=error) +OUT=$(lua-language-server --check="${DIR_SRC}" --configpath="${PWD}/.luarc.json" --checklevel=Information --logpath="${DIR_OUT}" --loglevel=error) RC=$? echo "${OUT}" >&2 From 7e3caf907514b9bfb2e803b53d64439091cd6600 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 30 Dec 2023 15:07:55 +1100 Subject: [PATCH 24/56] ci: temporary find to enumerate home --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca6dec54a06..33ff5aae14e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,3 +60,4 @@ jobs: - name: lua-language-server --check run: | VIMRUNTIME=/home/runner/nvim-v0.9.4 PATH="luals/bin:${PATH}" scripts/luals-check.sh + find /home From 00fe0a921d9da0581cc21f3f9703f22ae776c961 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 30 Dec 2023 15:09:44 +1100 Subject: [PATCH 25/56] ci: add VIMRUNTIME for lls --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33ff5aae14e..d9d0f26593c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,5 +59,5 @@ jobs: - name: lua-language-server --check run: | - VIMRUNTIME=/home/runner/nvim-v0.9.4 PATH="luals/bin:${PATH}" scripts/luals-check.sh + VIMRUNTIME=/home/runner/nvim-v0.9.4/runtime PATH="luals/bin:${PATH}" scripts/luals-check.sh find /home From 7f94529c37ec9c1aa3ed79b4763ee9c0ffd7dc8e Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 30 Dec 2023 15:10:30 +1100 Subject: [PATCH 26/56] ci: temporary find to enumerate home --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9d0f26593c..43b65fd66ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,5 +59,5 @@ jobs: - name: lua-language-server --check run: | - VIMRUNTIME=/home/runner/nvim-v0.9.4/runtime PATH="luals/bin:${PATH}" scripts/luals-check.sh find /home + VIMRUNTIME=/home/runner/nvim-v0.9.4/runtime PATH="luals/bin:${PATH}" scripts/luals-check.sh From f6fe6b32942c1ea30cfa3db1ac2de213b1302c3d Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 30 Dec 2023 17:01:01 +1100 Subject: [PATCH 27/56] ci: temporary find to enumerate home --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43b65fd66ed..85f21bb4ff2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,11 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: v0.9.4 + - name: install run: | mkdir -p luals From e51863e359992c9162ae6865755f36fbb3f6a170 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 30 Dec 2023 17:05:08 +1100 Subject: [PATCH 28/56] ci: remove temporary find to enumerate home --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85f21bb4ff2..bc140b7535d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,5 +64,4 @@ jobs: - name: lua-language-server --check run: | - find /home VIMRUNTIME=/home/runner/nvim-v0.9.4/runtime PATH="luals/bin:${PATH}" scripts/luals-check.sh From 4bd4717b39cf4fadc214021668b2ded7f1b8aebb Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 30 Dec 2023 17:09:52 +1100 Subject: [PATCH 29/56] ci: correct VIMRUNTIME --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc140b7535d..4061f4f146b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,4 +64,4 @@ jobs: - name: lua-language-server --check run: | - VIMRUNTIME=/home/runner/nvim-v0.9.4/runtime PATH="luals/bin:${PATH}" scripts/luals-check.sh + VIMRUNTIME=/home/runner/nvim-v0.9.4/share/nvim/runtime PATH="luals/bin:${PATH}" scripts/luals-check.sh From 824d7e7260a219c703945c978b43542babcbdb72 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 30 Dec 2023 17:24:42 +1100 Subject: [PATCH 30/56] ci: add ${3rd}/luv/library --- .luarc.json | 3 ++- lua/nvim-tree/git/runner.lua | 5 ----- lua/nvim-tree/node.lua | 4 ---- scripts/luals-check.sh | 5 +++++ 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.luarc.json b/.luarc.json index 2f25d795511..8c49d56db19 100644 --- a/.luarc.json +++ b/.luarc.json @@ -3,7 +3,8 @@ "runtime.version" : "Lua 5.1", "workspace": { "library": [ - "$VIMRUNTIME/lua/vim/lsp" + "$VIMRUNTIME/lua/vim/lsp", + "${3rd}/luv/library" ] }, "diagnostics": { diff --git a/lua/nvim-tree/git/runner.lua b/lua/nvim-tree/git/runner.lua index 8e2635df8bb..7ec4ab6ddca 100644 --- a/lua/nvim-tree/git/runner.lua +++ b/lua/nvim-tree/git/runner.lua @@ -2,11 +2,6 @@ local log = require "nvim-tree.log" local utils = require "nvim-tree.utils" local notify = require "nvim-tree.notify" --- TODO add "${3rd}/luv/library" to "workspace.library" ----@class uv.uv_handle_t: table ----@class uv.uv_stream_t: uv.uv_handle_t ----@class uv.uv_pipe_t: uv.uv_stream_t - ---@class Runner local Runner = {} Runner.__index = Runner diff --git a/lua/nvim-tree/node.lua b/lua/nvim-tree/node.lua index 323fc53c4c4..0ea6e76a845 100644 --- a/lua/nvim-tree/node.lua +++ b/lua/nvim-tree/node.lua @@ -1,9 +1,5 @@ ---@meta --- TODO add "${3rd}/luv/library" to "workspace.library" ----@class uv.uv_req_t: table ----@class uv.uv_fs_t: uv.uv_req_t - ---@class ParentNode ---@field name string diff --git a/scripts/luals-check.sh b/scripts/luals-check.sh index 9d8ddc7459a..b86fbc6fdf2 100755 --- a/scripts/luals-check.sh +++ b/scripts/luals-check.sh @@ -3,6 +3,11 @@ # Performs a lua-language-server check on all files. # luals-out/check.json will be produced on any issues, returning 1. # Outputs only check.json to stdout, all other messages to stderr, to allow jq etc. +# $VIMRUNTIME specifies neovim runtime path, defaults to "/usr/share/nvim/runtime" if unset. + +if [ -z "${VIMRUNTIME}" ]; then + export VIMRUNTIME="/usr/share/nvim/runtime" +fi DIR_SRC="lua" DIR_OUT="luals-out" From 99d4fbf313a7e0c8e17ad6acbf35a1ce9c2cea2d Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 30 Dec 2023 17:35:30 +1100 Subject: [PATCH 31/56] ci: note VIMRUNTIME override --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22d5f9e05ec..0b2f9a170d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,6 +36,11 @@ scripts/luals-check.sh Requires `lua-language-server` on your path. +Assumes neovim's `$VIMRUNTIME` is `"/usr/share/nvim/runtime"`. Override with: +```sh +VIMRUNTIME="/my/path/to/runtime" scripts/luals-check.sh +``` + # Adding new actions To add a new action, add a file in `actions/name-of-the-action.lua`. You should export a `setup` function if some configuration is needed. From 95b91463c005656981112a15674a184d4818e59b Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 16:40:05 +1100 Subject: [PATCH 32/56] ci: add Makefile --- .github/workflows/ci.yml | 16 +++++++--------- .gitignore | 1 + Makefile | 29 +++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4061f4f146b..0c853b6a887 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,10 @@ on: permissions: contents: read +env: + NVIM_VERSION: v0.9.4 + LUALS_VERSION: 3.7.3 + jobs: lint: runs-on: ubuntu-latest @@ -26,7 +30,7 @@ jobs: - name: luacheck run: | luarocks install luacheck 1.1.1 - luacheck lua + make lint style: runs-on: ubuntu-latest @@ -40,22 +44,16 @@ jobs: version: "0.19" args: --check lua - - name: doc-comments - run: ./scripts/doc-comments.sh - check: runs-on: ubuntu-latest - env: - LUALS_VERSION: 3.7.3 - steps: - uses: actions/checkout@v3 - uses: rhysd/action-setup-vim@v1 with: neovim: true - version: v0.9.4 + version: $NVIM_VERSION - name: install run: | @@ -64,4 +62,4 @@ jobs: - name: lua-language-server --check run: | - VIMRUNTIME=/home/runner/nvim-v0.9.4/share/nvim/runtime PATH="luals/bin:${PATH}" scripts/luals-check.sh + VIMRUNTIME=/home/runner/${NVIM_VERSION}/share/nvim/runtime PATH="luals/bin:${PATH}" make check diff --git a/.gitignore b/.gitignore index 5cd78185b8b..e4d0be68682 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /luals-out/ +/luals/ diff --git a/Makefile b/Makefile new file mode 100644 index 00000000000..497db222939 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +all: lint style check + +# +# mandatory checks +# +lint: + luacheck -q lua + scripts/doc-comments.sh + +style: + stylua lua --check + +check: + scripts/luals-check.sh + +# +# fixes +# +style-fix: + stylua lua + +# +# utility +# +update-help: + scripts/update-help.sh + +.PHONY: all style lint check style-fix update-help + From d353323ff564f5cb61d7add4eb7f4373bfa130e4 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 16:42:12 +1100 Subject: [PATCH 33/56] ci: add Makefile --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c853b6a887..15d38d0af98 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,7 @@ permissions: env: NVIM_VERSION: v0.9.4 + STYLUA_VERSION: 0.19 LUALS_VERSION: 3.7.3 jobs: @@ -41,7 +42,7 @@ jobs: uses: JohnnyMorganz/stylua-action@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - version: "0.19" + version: ${{ env.STYLUA_VERSION }} args: --check lua check: @@ -53,7 +54,7 @@ jobs: - uses: rhysd/action-setup-vim@v1 with: neovim: true - version: $NVIM_VERSION + version: ${{ env.NVIM_VERSION }} - name: install run: | From 4198691711d2485d003f533f0302de8cec79e7fa Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 16:46:53 +1100 Subject: [PATCH 34/56] ci: add Makefile --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15d38d0af98..fb6cc82b819 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,10 @@ permissions: contents: read env: - NVIM_VERSION: v0.9.4 - STYLUA_VERSION: 0.19 - LUALS_VERSION: 3.7.3 + LUA_VERSION: "5.1" + NVIM_VERSION: "v0.9.4" + STYLUA_VERSION: "0.19" + LUALS_VERSION: "3.7.3" jobs: lint: @@ -24,7 +25,7 @@ jobs: - uses: leafo/gh-actions-lua@v10 with: - luaVersion: "5.1" + luaVersion: ${{ env.LUA_VERSION }} - uses: leafo/gh-actions-luarocks@v4 @@ -63,4 +64,4 @@ jobs: - name: lua-language-server --check run: | - VIMRUNTIME=/home/runner/${NVIM_VERSION}/share/nvim/runtime PATH="luals/bin:${PATH}" make check + VIMRUNTIME=/home/runner/nvim-${NVIM_VERSION}/share/nvim/runtime PATH="luals/bin:${PATH}" make check From e14aa5ac9c71230e1e4fb9d0fac0e3404224347b Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 16:54:15 +1100 Subject: [PATCH 35/56] ci: add Makefile --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb6cc82b819..ffe16f2f46c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ permissions: env: LUA_VERSION: "5.1" NVIM_VERSION: "v0.9.4" - STYLUA_VERSION: "0.19" + STYLUA_VERSION: "0.19.1" LUALS_VERSION: "3.7.3" jobs: @@ -29,7 +29,7 @@ jobs: - uses: leafo/gh-actions-luarocks@v4 - - name: luacheck + - name: lint run: | luarocks install luacheck 1.1.1 make lint @@ -39,7 +39,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: stylua + - name: style uses: JohnnyMorganz/stylua-action@v3 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -62,6 +62,6 @@ jobs: mkdir -p luals curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${LUALS_VERSION}/lua-language-server-${LUALS_VERSION}-linux-x64.tar.gz" | tar zx --directory luals - - name: lua-language-server --check + - name: check run: | VIMRUNTIME=/home/runner/nvim-${NVIM_VERSION}/share/nvim/runtime PATH="luals/bin:${PATH}" make check From eb9f7cd654fb556492bba7052657627e1f5bc1dd Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 17:22:12 +1100 Subject: [PATCH 36/56] ci: document checks and fixes --- .hooks/pre-commit.sh | 5 ++-- CONTRIBUTING.md | 60 +++++++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 23 deletions(-) diff --git a/.hooks/pre-commit.sh b/.hooks/pre-commit.sh index a01efc2db2c..5b139ec3263 100755 --- a/.hooks/pre-commit.sh +++ b/.hooks/pre-commit.sh @@ -1,4 +1,3 @@ -#!/usr/bin/env bash +#!/bin/sh -stylua . --check || exit 1 -luacheck . || exit 1 +make diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0b2f9a170d4..c79d75db518 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,52 +4,72 @@ Thank you for contributing. See [Development](https://github.com/nvim-tree/nvim-tree.lua/wiki/Development) for environment setup, tips and tools. +# Tools + +Following are used during CI and strongly recommended during local development. + +Lint: [luacheck](https://github.com/lunarmodules/luacheck/) + +Style: [stylua] + +Language server: [luals](https://luals.github.io) + +You can install them via you OS package manager e.g. `pacman`, `brew` or other via other package managers such as `cargo` or `luarocks` + # Quality -The following quality checks are mandatory and are performed during CI: +The following quality checks are mandatory and are performed during CI. They run on the entire `lua` directory` return 1 on any failure. -## Styling and formatting +You can run them all via `make` or `make all` -Code is formatted using luacheck, and linted using stylua. -You may install these via your package manager or with: +You can setup the git hooks by running `scripts/setup-hooks.sh` -```bash -luarocks install luacheck -cargo install stylua +## lint + +```sh +make lint ``` -Run: +1. Runs luacheck quietly using `.luacheck` settings +1. Runs `scripts/doc-comments.sh` to validate annotated documentation + +## style + +Runs stylua using `.stylua.toml` settings: + ```sh -stylua lua -luacheck lua +make style ``` -You can setup the git hooks by running `scripts/setup-hooks.sh`. +You can automatically fix style issues via: -## Check +```sh +make style-fix +``` + +## check -[luals](https://luals.github.io) check is run with: +Runs the checks that the LSP lua language server runs inside nvim using `.luarc.json` ```sh -scripts/luals-check.sh +make check ``` -Requires `lua-language-server` on your path. +Assumes `$VIMRUNTIME` is `/usr/share/nvim/runtime`. Adjust as necessary e.g. -Assumes neovim's `$VIMRUNTIME` is `"/usr/share/nvim/runtime"`. Override with: ```sh -VIMRUNTIME="/my/path/to/runtime" scripts/luals-check.sh +VIMRUNTIME="/my/path/to/runtime" make check ``` -# Adding new actions +# Adding New Actions To add a new action, add a file in `actions/name-of-the-action.lua`. You should export a `setup` function if some configuration is needed. -Once you did, you should run the `scripts/update-help.sh`. + +Once you did, you should run `make update-help` # Documentation When adding new options, you should declare the defaults in the main `nvim-tree.lua` file. -Once you did, you should run the `scripts/update-help.sh`. Documentation for options should also be added to `nvim-tree-opts` in `doc/nvim-tree-lua.txt` From e1fae6906ecfd5169ab7d0d16134b46a93d115af Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 17:27:49 +1100 Subject: [PATCH 37/56] ci: add help check --- .github/workflows/ci.yml | 6 +++++- CONTRIBUTING.md | 2 +- Makefile | 13 ++++++++++--- scripts/{update-help.sh => help-update.sh} | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) rename scripts/{update-help.sh => help-update.sh} (95%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffe16f2f46c..202dae2de38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,6 +62,10 @@ jobs: mkdir -p luals curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${LUALS_VERSION}/lua-language-server-${LUALS_VERSION}-linux-x64.tar.gz" | tar zx --directory luals - - name: check + - name: language server run: | VIMRUNTIME=/home/runner/nvim-${NVIM_VERSION}/share/nvim/runtime PATH="luals/bin:${PATH}" make check + + - name: help + run: | + make check-help diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c79d75db518..5e2f2d5d73b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,7 +65,7 @@ VIMRUNTIME="/my/path/to/runtime" make check To add a new action, add a file in `actions/name-of-the-action.lua`. You should export a `setup` function if some configuration is needed. -Once you did, you should run `make update-help` +Once you did, you should run `make help-update` # Documentation diff --git a/Makefile b/Makefile index 497db222939..bb94fece88f 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,15 @@ style-fix: # # utility # -update-help: - scripts/update-help.sh +help-update: + scripts/help-update.sh -.PHONY: all style lint check style-fix update-help +# +# CI +# +help-check: + scripts/help-update.sh + git diff --exit-code doc/nvim-tree-lua.txt + +.PHONY: all style lint check style-fix help-check help-update diff --git a/scripts/update-help.sh b/scripts/help-update.sh similarity index 95% rename from scripts/update-help.sh rename to scripts/help-update.sh index b88de2250be..3fa00e907af 100755 --- a/scripts/update-help.sh +++ b/scripts/help-update.sh @@ -2,7 +2,7 @@ # run after changing nvim-tree.lua DEFAULT_OPTS or keymap.lua M.default_on_attach # scrapes and updates nvim-tree-lua.txt -# run from repository root: scripts/update-help.sh +# run from repository root: scripts/help-update.sh OR make help-update # From 5e62d1ea27abfdfe89816cf54ff69614397ff4b3 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 17:28:59 +1100 Subject: [PATCH 38/56] ci: add help check --- .github/workflows/ci.yml | 2 +- Makefile | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 202dae2de38..8c6753ddd24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,4 +68,4 @@ jobs: - name: help run: | - make check-help + make help-check diff --git a/Makefile b/Makefile index bb94fece88f..d94176d48a0 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,7 @@ help-update: # # CI # -help-check: - scripts/help-update.sh +help-check: help-update git diff --exit-code doc/nvim-tree-lua.txt .PHONY: all style lint check style-fix help-check help-update From c50cceaa4aef2f62e74db18d27be560bd76a852a Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 17:30:00 +1100 Subject: [PATCH 39/56] ci: dummy help failure --- lua/nvim-tree.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 8c0fb2274aa..f96b33db77f 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -567,6 +567,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS notify = { threshold = vim.log.levels.INFO, absolute_path = true, + absolute_path1 = true, }, help = { sort_by = "key", From ed0c82f8e884b0b9e59d0fb2759a2f67b57ce493 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 17:31:59 +1100 Subject: [PATCH 40/56] Revert "ci: dummy help failure" This reverts commit c50cceaa4aef2f62e74db18d27be560bd76a852a. --- lua/nvim-tree.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index f96b33db77f..8c0fb2274aa 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -567,7 +567,6 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS notify = { threshold = vim.log.levels.INFO, absolute_path = true, - absolute_path1 = true, }, help = { sort_by = "key", From 828bbc8bc374b8948befb8f8804372107d71f77e Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 17:33:51 +1100 Subject: [PATCH 41/56] ci: document checks and fixes --- CONTRIBUTING.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5e2f2d5d73b..206ede18d71 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ Following are used during CI and strongly recommended during local development. Lint: [luacheck](https://github.com/lunarmodules/luacheck/) -Style: [stylua] +Style: [StyLua](https://github.com/JohnnyMorganz/StyLua) Language server: [luals](https://luals.github.io) @@ -22,17 +22,17 @@ The following quality checks are mandatory and are performed during CI. They run You can run them all via `make` or `make all` -You can setup the git hooks by running `scripts/setup-hooks.sh` +You can setup git hooks to run all checks by running `scripts/setup-hooks.sh` ## lint +1. Runs luacheck quietly using `.luacheck` settings +1. Runs `scripts/doc-comments.sh` to validate annotated documentation + ```sh make lint ``` -1. Runs luacheck quietly using `.luacheck` settings -1. Runs `scripts/doc-comments.sh` to validate annotated documentation - ## style Runs stylua using `.stylua.toml` settings: From fa7ebc229aed0384fa90a026935d105c6cd7e984 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 31 Dec 2023 17:37:08 +1100 Subject: [PATCH 42/56] ci: document checks and fixes --- .github/workflows/ci.yml | 5 +---- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c6753ddd24..4136a6b468e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,10 +62,7 @@ jobs: mkdir -p luals curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${LUALS_VERSION}/lua-language-server-${LUALS_VERSION}-linux-x64.tar.gz" | tar zx --directory luals - - name: language server + - name: check run: | VIMRUNTIME=/home/runner/nvim-${NVIM_VERSION}/share/nvim/runtime PATH="luals/bin:${PATH}" make check - - - name: help - run: | make help-check diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 206ede18d71..07b4382b850 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ You can install them via you OS package manager e.g. `pacman`, `brew` or other v # Quality -The following quality checks are mandatory and are performed during CI. They run on the entire `lua` directory` return 1 on any failure. +The following quality checks are mandatory and are performed during CI. They run on the entire `lua` directory and return 1 on any failure. You can run them all via `make` or `make all` From a8cb50d39d2be87bf10e010be3b534ea3b7a6656 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 10:30:14 +1100 Subject: [PATCH 43/56] ci: matrix nvim version --- .github/workflows/ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4136a6b468e..cd1e0dc3b3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,11 +13,13 @@ permissions: env: LUA_VERSION: "5.1" - NVIM_VERSION: "v0.9.4" STYLUA_VERSION: "0.19.1" LUALS_VERSION: "3.7.3" jobs: + strategy: + matrix: + NVIM_VERSION: [ "v0.8.3", "v0.9.4" ] lint: runs-on: ubuntu-latest steps: @@ -55,7 +57,7 @@ jobs: - uses: rhysd/action-setup-vim@v1 with: neovim: true - version: ${{ env.NVIM_VERSION }} + version: ${{ matrix.NVIM_VERSION }} - name: install run: | @@ -64,5 +66,5 @@ jobs: - name: check run: | - VIMRUNTIME=/home/runner/nvim-${NVIM_VERSION}/share/nvim/runtime PATH="luals/bin:${PATH}" make check + VIMRUNTIME=/home/runner/nvim-${{ matrix.NVIM_VERSION }}/share/nvim/runtime PATH="luals/bin:${PATH}" make check make help-check From fcef6a11e9d7dd3533c548e027fd51e8f298569b Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 10:33:30 +1100 Subject: [PATCH 44/56] ci: matrix nvim version --- .github/workflows/ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd1e0dc3b3f..a112ff5cbdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,6 @@ env: LUALS_VERSION: "3.7.3" jobs: - strategy: - matrix: - NVIM_VERSION: [ "v0.8.3", "v0.9.4" ] lint: runs-on: ubuntu-latest steps: @@ -49,6 +46,10 @@ jobs: args: --check lua check: + strategy: + matrix: + NVIM_VERSION: [ "v0.8.3", "v0.9.4" ] + runs-on: ubuntu-latest steps: From 1b509db08227fe1329c99e68251ffeddac768307 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 10:46:15 +1100 Subject: [PATCH 45/56] Revert "ci: matrix nvim version" This reverts commit fcef6a11e9d7dd3533c548e027fd51e8f298569b. --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a112ff5cbdd..cd1e0dc3b3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,9 @@ env: LUALS_VERSION: "3.7.3" jobs: + strategy: + matrix: + NVIM_VERSION: [ "v0.8.3", "v0.9.4" ] lint: runs-on: ubuntu-latest steps: @@ -46,10 +49,6 @@ jobs: args: --check lua check: - strategy: - matrix: - NVIM_VERSION: [ "v0.8.3", "v0.9.4" ] - runs-on: ubuntu-latest steps: From 6b0fcc4ffa23015234cdf358c9321ccdd278a8ae Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 10:46:27 +1100 Subject: [PATCH 46/56] Revert "ci: matrix nvim version" This reverts commit a8cb50d39d2be87bf10e010be3b534ea3b7a6656. --- .github/workflows/ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd1e0dc3b3f..4136a6b468e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,13 +13,11 @@ permissions: env: LUA_VERSION: "5.1" + NVIM_VERSION: "v0.9.4" STYLUA_VERSION: "0.19.1" LUALS_VERSION: "3.7.3" jobs: - strategy: - matrix: - NVIM_VERSION: [ "v0.8.3", "v0.9.4" ] lint: runs-on: ubuntu-latest steps: @@ -57,7 +55,7 @@ jobs: - uses: rhysd/action-setup-vim@v1 with: neovim: true - version: ${{ matrix.NVIM_VERSION }} + version: ${{ env.NVIM_VERSION }} - name: install run: | @@ -66,5 +64,5 @@ jobs: - name: check run: | - VIMRUNTIME=/home/runner/nvim-${{ matrix.NVIM_VERSION }}/share/nvim/runtime PATH="luals/bin:${PATH}" make check + VIMRUNTIME=/home/runner/nvim-${NVIM_VERSION}/share/nvim/runtime PATH="luals/bin:${PATH}" make check make help-check From 1a24ad8b6782865147a85c4ec6008eba8f29970a Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 10:51:15 +1100 Subject: [PATCH 47/56] ci: matrix nvim version from env --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4136a6b468e..2274afd91bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ permissions: env: LUA_VERSION: "5.1" - NVIM_VERSION: "v0.9.4" + NVIM_VERSION: [ "v0.8.3" "v0.9.4" ] STYLUA_VERSION: "0.19.1" LUALS_VERSION: "3.7.3" @@ -47,6 +47,9 @@ jobs: args: --check lua check: + strategy: + matrix: + nvim_version: ${{ env.NVIM_VERSION }} runs-on: ubuntu-latest steps: @@ -55,7 +58,7 @@ jobs: - uses: rhysd/action-setup-vim@v1 with: neovim: true - version: ${{ env.NVIM_VERSION }} + version: ${{ matrix.nvim_version }} - name: install run: | @@ -64,5 +67,5 @@ jobs: - name: check run: | - VIMRUNTIME=/home/runner/nvim-${NVIM_VERSION}/share/nvim/runtime PATH="luals/bin:${PATH}" make check + VIMRUNTIME=/home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime PATH="luals/bin:${PATH}" make check make help-check From 2ad6aa50a1d12b3e83cdd0b7b03f564e162214c1 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 10:52:37 +1100 Subject: [PATCH 48/56] ci: matrix nvim version from env --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2274afd91bd..ee24989c48f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ permissions: env: LUA_VERSION: "5.1" - NVIM_VERSION: [ "v0.8.3" "v0.9.4" ] + NVIM_VERSION: "v0.8.3 v0.9.4" STYLUA_VERSION: "0.19.1" LUALS_VERSION: "3.7.3" From b0f55dc33410a46da05699ff986b6ae91f012fcf Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 10:53:49 +1100 Subject: [PATCH 49/56] ci: matrix nvim version from env --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee24989c48f..8b08023819a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ permissions: env: LUA_VERSION: "5.1" - NVIM_VERSION: "v0.8.3 v0.9.4" + NVIM_VERSION: "[ v0.8.3 v0.9.4 ]" STYLUA_VERSION: "0.19.1" LUALS_VERSION: "3.7.3" From 995d3cb6e169b66d0de8f6d8e4f91457437d989c Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 10:59:12 +1100 Subject: [PATCH 50/56] ci: matrix nvim version --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b08023819a..cb15cab14ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ permissions: env: LUA_VERSION: "5.1" - NVIM_VERSION: "[ v0.8.3 v0.9.4 ]" + NVIM_VERSION: [ "v0.8.3" "v0.9.4" ] STYLUA_VERSION: "0.19.1" LUALS_VERSION: "3.7.3" @@ -49,7 +49,7 @@ jobs: check: strategy: matrix: - nvim_version: ${{ env.NVIM_VERSION }} + nvim_version: fromJson( ${{ env.NVIM_VERSION }} ) runs-on: ubuntu-latest steps: From 1aa25740ff060bc916618951c07448d348620e0c Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 11:00:49 +1100 Subject: [PATCH 51/56] ci: matrix nvim version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb15cab14ee..1ebb739e3cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ permissions: env: LUA_VERSION: "5.1" - NVIM_VERSION: [ "v0.8.3" "v0.9.4" ] + NVIM_VERSION: ("v0.8.3" "v0.9.4") STYLUA_VERSION: "0.19.1" LUALS_VERSION: "3.7.3" From 9311fd83439aed1878ca5467e7a6f2120b7cd22a Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 11:05:27 +1100 Subject: [PATCH 52/56] ci: matrix per job --- .github/workflows/ci.yml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ebb739e3cd..99f3ea6ade3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,21 +11,20 @@ on: permissions: contents: read -env: - LUA_VERSION: "5.1" - NVIM_VERSION: ("v0.8.3" "v0.9.4") - STYLUA_VERSION: "0.19.1" - LUALS_VERSION: "3.7.3" - jobs: lint: runs-on: ubuntu-latest + + strategy: + matrix: + lua_version: [ "5.1" ] + steps: - uses: actions/checkout@v4 - uses: leafo/gh-actions-lua@v10 with: - luaVersion: ${{ env.LUA_VERSION }} + luaVersion: ${{ matrix.lua_version }} - uses: leafo/gh-actions-luarocks@v4 @@ -36,6 +35,11 @@ jobs: style: runs-on: ubuntu-latest + + strategy: + matrix: + stylua_version: [ "0.19.1" ] + steps: - uses: actions/checkout@v4 @@ -43,14 +47,16 @@ jobs: uses: JohnnyMorganz/stylua-action@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - version: ${{ env.STYLUA_VERSION }} + version: ${{ matrix.stylua_version }} args: --check lua check: + runs-on: ubuntu-latest + strategy: matrix: - nvim_version: fromJson( ${{ env.NVIM_VERSION }} ) - runs-on: ubuntu-latest + nvim_version: [ "v0.8.3" "v0.9.4" ] + luals_version: [ "3.7.3" ] steps: - uses: actions/checkout@v3 @@ -63,7 +69,7 @@ jobs: - name: install run: | mkdir -p luals - curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${LUALS_VERSION}/lua-language-server-${LUALS_VERSION}-linux-x64.tar.gz" | tar zx --directory luals + curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${{ matrix.luals_version }}/lua-language-server-${{ matrix.luals_version }}-linux-x64.tar.gz" | tar zx --directory luals - name: check run: | From 81b32caf886f4d0eb8044098920835c54eff8294 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 11:07:08 +1100 Subject: [PATCH 53/56] ci: matrix per job --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99f3ea6ade3..213a8358e61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: strategy: matrix: - nvim_version: [ "v0.8.3" "v0.9.4" ] + nvim_version: [ "v0.8.3", "v0.9.4" ] luals_version: [ "3.7.3" ] steps: From 003752cd709cc1bca6f6078baea86cca2cc55e30 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 11:08:56 +1100 Subject: [PATCH 54/56] ci: many lua versions --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 213a8358e61..30ea47bd126 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - lua_version: [ "5.1" ] + lua_version: [ 5.1, 5.2, 5.3, 5.4 ] steps: - uses: actions/checkout@v4 @@ -38,7 +38,7 @@ jobs: strategy: matrix: - stylua_version: [ "0.19.1" ] + stylua_version: [ 0.19.1 ] steps: - uses: actions/checkout@v4 @@ -55,8 +55,8 @@ jobs: strategy: matrix: - nvim_version: [ "v0.8.3", "v0.9.4" ] - luals_version: [ "3.7.3" ] + nvim_version: [ v0.9.4 ] + luals_version: [ 3.7.3 ] steps: - uses: actions/checkout@v3 From 077d56eea1a1aec959f721a2d4fbfb4d04fd29f9 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 11:17:53 +1100 Subject: [PATCH 55/56] ci: move doc to style --- .github/workflows/ci.yml | 41 +++++++++++++++++++++------------------- Makefile | 8 +++++--- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30ea47bd126..342066d5e44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - lua_version: [ 5.1, 5.2, 5.3, 5.4 ] + lua_version: [ 5.1 ] steps: - uses: actions/checkout@v4 @@ -28,8 +28,7 @@ jobs: - uses: leafo/gh-actions-luarocks@v4 - - name: lint - run: | + - run: | luarocks install luacheck 1.1.1 make lint @@ -50,6 +49,10 @@ jobs: version: ${{ matrix.stylua_version }} args: --check lua + - name: doc + run: | + make doc-style + check: runs-on: ubuntu-latest @@ -59,19 +62,19 @@ jobs: luals_version: [ 3.7.3 ] steps: - - uses: actions/checkout@v3 - - - uses: rhysd/action-setup-vim@v1 - with: - neovim: true - version: ${{ matrix.nvim_version }} - - - name: install - run: | - mkdir -p luals - curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${{ matrix.luals_version }}/lua-language-server-${{ matrix.luals_version }}-linux-x64.tar.gz" | tar zx --directory luals - - - name: check - run: | - VIMRUNTIME=/home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime PATH="luals/bin:${PATH}" make check - make help-check + - uses: actions/checkout@v3 + + - uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: ${{ matrix.nvim_version }} + + - name: install + run: | + mkdir -p luals + curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${{ matrix.luals_version }}/lua-language-server-${{ matrix.luals_version }}-linux-x64.tar.gz" | tar zx --directory luals + + - name: check + run: | + VIMRUNTIME=/home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime PATH="luals/bin:${PATH}" make check + make help-check diff --git a/Makefile b/Makefile index d94176d48a0..c518901ebdb 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,8 @@ all: lint style check # lint: luacheck -q lua - scripts/doc-comments.sh -style: +style: style-doc stylua lua --check check: @@ -31,5 +30,8 @@ help-update: help-check: help-update git diff --exit-code doc/nvim-tree-lua.txt -.PHONY: all style lint check style-fix help-check help-update +style-doc: + scripts/doc-comments.sh + +.PHONY: all style lint check style-fix help-check help-update style-doc From 59b34b8be423945429d8b7808db564348a3b3df0 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 1 Jan 2024 11:28:11 +1100 Subject: [PATCH 56/56] ci: tidy ci and contributing --- .github/workflows/ci.yml | 22 ++++++++++------------ CONTRIBUTING.md | 8 ++++---- Makefile | 22 ++++++++++++++++------ 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 342066d5e44..bd6cd4e0451 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,9 +28,9 @@ jobs: - uses: leafo/gh-actions-luarocks@v4 - - run: | - luarocks install luacheck 1.1.1 - make lint + - run: luarocks install luacheck 1.1.1 + + - run: make lint style: runs-on: ubuntu-latest @@ -42,16 +42,14 @@ jobs: steps: - uses: actions/checkout@v4 - - name: style + - name: stylua uses: JohnnyMorganz/stylua-action@v3 with: token: ${{ secrets.GITHUB_TOKEN }} version: ${{ matrix.stylua_version }} args: --check lua - - name: doc - run: | - make doc-style + - run: make style-doc check: runs-on: ubuntu-latest @@ -69,12 +67,12 @@ jobs: neovim: true version: ${{ matrix.nvim_version }} - - name: install + - name: install luals run: | mkdir -p luals curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${{ matrix.luals_version }}/lua-language-server-${{ matrix.luals_version }}-linux-x64.tar.gz" | tar zx --directory luals - - name: check - run: | - VIMRUNTIME=/home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime PATH="luals/bin:${PATH}" make check - make help-check + - name: make check + run: VIMRUNTIME=/home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime PATH="luals/bin:${PATH}" make check + + - run: make help-check diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 07b4382b850..fc5d33fc185 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,6 @@ You can setup git hooks to run all checks by running `scripts/setup-hooks.sh` ## lint 1. Runs luacheck quietly using `.luacheck` settings -1. Runs `scripts/doc-comments.sh` to validate annotated documentation ```sh make lint @@ -35,13 +34,14 @@ make lint ## style -Runs stylua using `.stylua.toml` settings: +1. Runs stylua using `.stylua.toml` settings +1. Runs `scripts/doc-comments.sh` to validate annotated documentation ```sh make style ``` -You can automatically fix style issues via: +You can automatically fix stylua issues via: ```sh make style-fix @@ -49,7 +49,7 @@ make style-fix ## check -Runs the checks that the LSP lua language server runs inside nvim using `.luarc.json` +1. Runs the checks that the LSP lua language server runs inside nvim using `.luarc.json` via `scripts/luals-check.sh` ```sh make check diff --git a/Makefile b/Makefile index c518901ebdb..7260b83a972 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,25 @@ all: lint style check # # mandatory checks # -lint: +lint: luacheck + +style: stylua style-doc + +check: luals + +# +# subtasks +# +luacheck: luacheck -q lua -style: style-doc +stylua: stylua lua --check -check: +style-doc: + scripts/doc-comments.sh + +luals: scripts/luals-check.sh # @@ -30,8 +42,6 @@ help-update: help-check: help-update git diff --exit-code doc/nvim-tree-lua.txt -style-doc: - scripts/doc-comments.sh -.PHONY: all style lint check style-fix help-check help-update style-doc +.PHONY: all lint style check luacheck stylua style-doc luals style-fix help-update help-check