ci: consistently enforce the yazi lua coding style

This commit adds a GitHub Actions workflow that checks the lua files
against the yazi lua coding style.

The workflow uses the `stylua` tool, which can be installed using cargo:

```sh
cargo install stylua --features lua54
```

I picked the options for the formatter in a way that forced minimal
changes to the existing style.

<https://github.com/JohnnyMorganz/StyLua?tab=readme-ov-file#options>

Update .github/workflows/check.yml

Co-authored-by: 三咲雅 · Misaki Masa <sxyazi@gmail.com>
This commit is contained in:
Mika Vilpas 2024-05-12 19:21:19 +03:00
parent 28dfe728ab
commit b8264fcb75
3 changed files with 17 additions and 0 deletions

View file

@ -39,3 +39,15 @@ jobs:
- name: Rustfmt
run: cargo +nightly fmt --all -- --check
stylua:
name: stylua
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
# CLI arguments
args: --color always --check .

2
.styluaignore Normal file
View file

@ -0,0 +1,2 @@
# this file caused some issues with the build system
yazi-plugin/preset/plugins/mime.lua

3
stylua.toml Normal file
View file

@ -0,0 +1,3 @@
indent_width = 2
call_parentheses = "NoSingleTable"
collapse_simple_statement = "FunctionOnly"