From b8264fcb75ad937cdc37d4672924d29679dcf351 Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Sun, 12 May 2024 19:21:19 +0300 Subject: [PATCH] ci: consistently enforce the yazi lua coding style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Update .github/workflows/check.yml Co-authored-by: 三咲雅 · Misaki Masa --- .github/workflows/check.yml | 12 ++++++++++++ .styluaignore | 2 ++ stylua.toml | 3 +++ 3 files changed, 17 insertions(+) create mode 100644 .styluaignore create mode 100644 stylua.toml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index ce034802..80533b5a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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 . diff --git a/.styluaignore b/.styluaignore new file mode 100644 index 00000000..d8e2f141 --- /dev/null +++ b/.styluaignore @@ -0,0 +1,2 @@ +# this file caused some issues with the build system +yazi-plugin/preset/plugins/mime.lua diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 00000000..b511561d --- /dev/null +++ b/stylua.toml @@ -0,0 +1,3 @@ +indent_width = 2 +call_parentheses = "NoSingleTable" +collapse_simple_statement = "FunctionOnly"