From 6370fb34f12b9ba8b2a916d840514889c27b3d16 Mon Sep 17 00:00:00 2001 From: Mist Date: Mon, 12 Feb 2024 20:47:32 +0800 Subject: [PATCH] [Feat] add code style checker --- .github/workflows/lint.yml | 9 ++++++++- stylua.toml | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 stylua.toml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e4299b3..339f2b2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,5 +17,12 @@ jobs: - name: Install commit message convention lib run: npm i commitlint-config-wizardoc -D - - name: Check lint name convention + - name: Check commit message uses: wagoid/commitlint-github-action@v4 + + - name: Check code style + - uses: JohnnyMorganz/stylua-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: latest + args: --check . diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..fb3dcf8 --- /dev/null +++ b/stylua.toml @@ -0,0 +1,10 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "Always" +collapse_simple_statement = "Never" + +[sort_requires] +enabled = false