Skip to content

chore: set GITHUB_PATH in env #3087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5bc23f3
chore: sync EmmyLuaCodeStyle settings between .editorconfig and .luar…
alex-courtis Mar 21, 2025
3a27e36
chore: lua-language-server 3.11.0 -> 3.13.9
alex-courtis Mar 21, 2025
bb46ca0
chore: fix incorrect definition of vim.loop.fs_lstat
alex-courtis Mar 22, 2025
e02ba60
chore: add codestyle-check option to luals-check.sh
alex-courtis Mar 22, 2025
df044f7
chore: use luals for style check
alex-courtis Mar 22, 2025
e5fde80
chore: use luals for style check
alex-courtis Mar 22, 2025
9d93eb6
Revert "chore: use luals for style check"
alex-courtis Mar 22, 2025
079e6b9
chore: use luals for style check
alex-courtis Mar 22, 2025
b25f852
chore: use luals for style check
alex-courtis Mar 22, 2025
49f77c9
chore: use luals for style check
alex-courtis Mar 22, 2025
b4fd80d
chore: use luals for style check
alex-courtis Mar 22, 2025
93475cd
chore: use luals for style check
alex-courtis Mar 22, 2025
c83f971
chore: use luals for style check
alex-courtis Mar 22, 2025
9840634
chore: use luals for style check
alex-courtis Mar 22, 2025
f7e8f65
chore: use luals for style check
alex-courtis Mar 22, 2025
30615dd
chore: use luals for style check
alex-courtis Mar 22, 2025
a8c5276
chore: use luals for style check
alex-courtis Mar 22, 2025
fda709c
chore: use luals for style check
alex-courtis Mar 22, 2025
2c12c89
chore: use luals for style check
alex-courtis Mar 22, 2025
60fd7d2
chore: set GITHUB_PATH in env
alex-courtis Mar 23, 2025
48305d8
chore: set GITHUB_PATH in env
alex-courtis Mar 23, 2025
a0297e3
chore: set GITHUB_PATH in env
alex-courtis Mar 23, 2025
cb507c4
chore: set GITHUB_PATH in env
alex-courtis Mar 23, 2025
a69dc22
chore: set GITHUB_PATH in env
alex-courtis Mar 23, 2025
7de7dfd
chore: set GITHUB_PATH in env
alex-courtis Mar 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ end_of_line = lf
[nvim-tree-lua.txt]
max_line_length = 78

# keep these in sync with .luarc.json
# .editorconfig is used within nvim, overriding .luarc.json
# .luarc.json is used by style check
[*.lua]
indent_style = space
max_line_length = 140
Expand Down
73 changes: 34 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,25 @@ jobs:
strategy:
matrix:
lua_version: [ 5.1 ]
luacheck_version: [ 1.2.0 ]

steps:
- uses: actions/checkout@v4
- name: checkout
uses: actions/checkout@v4

- uses: leafo/gh-actions-lua@v11
- name: install lua ${{ matrix.lua_version }}
uses: leafo/gh-actions-lua@v11
with:
luaVersion: ${{ matrix.lua_version }}

- uses: leafo/gh-actions-luarocks@v4
- name: install luarocks
uses: leafo/gh-actions-luarocks@v5

- run: luarocks install luacheck 1.1.1
- name: install luacheck ${{ matrix.luacheck_version }}
run: luarocks install luacheck ${{ matrix.luacheck_version }}

- run: make lint

style:
runs-on: ubuntu-latest

concurrency:
group: ${{ github.workflow }}-${{ matrix.emmy_lua_code_style_version }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

strategy:
matrix:
emmy_lua_code_style_version: [ 1.5.6 ]

steps:
- uses: actions/checkout@v4

- name: install emmy_lua_code_style
run: |
mkdir -p CodeFormat
curl -L "https://github.com/CppCXY/EmmyLuaCodeStyle/releases/download/${{ matrix.emmy_lua_code_style_version }}/linux-x64.tar.gz" | tar zx --directory CodeFormat

- run: echo "CodeFormat/linux-x64/bin" >> "$GITHUB_PATH"

- run: make style

- run: make style-doc

check:
runs-on: ubuntu-latest

Expand All @@ -69,26 +49,41 @@ jobs:
strategy:
matrix:
nvim_version: [ stable, nightly ]
luals_version: [ 3.11.0 ]
luals_version: [ 3.13.9 ]

env:
VIMRUNTIME: /home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime

steps:
- uses: actions/checkout@v4
- name: checkout
uses: actions/checkout@v4

- uses: rhysd/action-setup-vim@v1
- name: install nvim ${{ matrix.nvim_version }}
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: ${{ matrix.nvim_version }}

- name: install luals
- name: install lua-language-server ${{ matrix.luals_version }}
run: |
echo "------"
env
echo "------"
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
echo "luals/bin" >> "$GITHUB_PATH"
echo "------"
env
echo "------"

- run: echo "luals/bin" >> "$GITHUB_PATH"

- name: make check
env:
VIMRUNTIME: /home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime
run: make check
- run: |
echo "------"
env
echo "------"
make check

- run: make help-check

- run: make style

- run: make style-doc
13 changes: 12 additions & 1 deletion .luarc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"runtime.version.luals-check-only": "Lua 5.1",
"workspace": {
"library": [
"$VIMRUNTIME/lua/vim",
"${3rd}/luv/library"
]
},
"format": {
"defaultConfig": {
"indent_style": "space",
"max_line_length": "140",
"indent_size": "2",
"continuation_indent": "2",
"quote_style": "double",
"call_arg_parentheses": "always",
"space_before_closure_open_parenthesis": "false",
"align_continuous_similar_call_args": "true"
}
},
"diagnostics": {
"libraryFiles": "Disable",
"globals": [],
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Language server: [luals](https://luals.github.io)

Lint: [luacheck](https://github.com/lunarmodules/luacheck/)

Style: [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle): `CodeCheck`
Style Fixing: [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle): `CodeCheck`

nvim-tree.lua migrated from stylua to EmmyLuaCodeStyle ~2024/10. `vim.lsp.buf.format()` may be used as it is the default formatter for luals
nvim-tree.lua migrated from stylua to EmmyLuaCodeStyle ~2024/10. `vim.lsp.buf.format()` may be used as it is the default formatter for luals, using an embedded [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle)

You can install them via you OS package manager e.g. `pacman`, `brew` or other via other package managers such as `cargo` or `luarocks`

Expand All @@ -36,14 +36,14 @@ make lint

## style

1. Runs CodeCheck using `.editorconfig` settings
1. Runs lua language server `codestyle-check` only, using `.luarc.json` settings
1. Runs `scripts/doc-comments.sh` to validate annotated documentation

```sh
make style
```

You can automatically fix `CodeCheck` issues via:
You can automatically fix style issues using `CodeCheck`:

```sh
make style-fix
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ luacheck:

# --diagnosis-as-error does not function for workspace, hence we post-process the output
style-check:
CodeFormat check --config .editorconfig --diagnosis-as-error --workspace lua
@scripts/luals-check.sh codestyle-check

style-doc:
scripts/doc-comments.sh
Expand Down
10 changes: 6 additions & 4 deletions lua/nvim-tree/explorer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ function Explorer:reload(node, project)
end

local abs = utils.path_join({ cwd, name })
---@type uv.fs_stat.result|nil
local stat = vim.loop.fs_lstat(abs)

-- path incorrectly specified as an integer
local stat = vim.loop.fs_lstat(abs) ---@diagnostic disable-line param-type-mismatch

local filter_reason = self.filters:should_filter_as_reason(abs, stat, filter_status)
if filter_reason == FILTER_REASON.none then
Expand Down Expand Up @@ -373,8 +374,9 @@ function Explorer:populate_children(handle, cwd, node, project, parent)
if Watcher.is_fs_event_capable(abs) then
local profile = log.profile_start("populate_children %s", abs)

---@type uv.fs_stat.result|nil
local stat = vim.loop.fs_lstat(abs)
-- path incorrectly specified as an integer
local stat = vim.loop.fs_lstat(abs) ---@diagnostic disable-line param-type-mismatch

local filter_reason = parent.filters:should_filter_as_reason(abs, stat, filter_status)
if filter_reason == FILTER_REASON.none and not nodes_by_path[abs] then
local child = node_factory.create({
Expand Down
23 changes: 19 additions & 4 deletions scripts/luals-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# 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.
#
# Call with codestyle-check param to enable only codestyle-check

if [ -z "${VIMRUNTIME}" ]; then
export VIMRUNTIME="/usr/share/nvim/runtime"
Expand All @@ -17,11 +19,24 @@ FILE_LUARC="${DIR_OUT}/luarc.json"
rm -rf "${DIR_OUT}"
mkdir "${DIR_OUT}"

# Uncomment runtime.version for strict neovim baseline 5.1
# It is not set normally, to prevent luals loading 5.1 and 5.x, resulting in both versions being chosen on vim.lsp.buf.definition()
cat "${PWD}/.luarc.json" | sed -E 's/.luals-check-only//g' > "${FILE_LUARC}"
case "${1}" in
"codestyle-check")
jq \
'.diagnostics.neededFileStatus[] = "None" | .diagnostics.neededFileStatus."codestyle-check" = "Any"' \
"${PWD}/.luarc.json" > "${FILE_LUARC}"

# execute inside lua to prevent luals itself from being checked
;;
*)
# Add runtime.version for strict neovim baseline 5.1
# It is not set normally, to prevent luals loading 5.1 and 5.x, resulting in both versions being chosen on vim.lsp.buf.definition
jq \
'."runtime.version" = "Lua 5.1"' \
"${PWD}/.luarc.json" > "${FILE_LUARC}"

;;
esac

# execute inside lua directory to prevent luals itself from being checked
OUT=$(lua-language-server --check="${DIR_SRC}" --configpath="${FILE_LUARC}" --checklevel=Information --logpath="${DIR_OUT}" --loglevel=error)
RC=$?

Expand Down
Loading