diff options
| -rw-r--r-- | .github/workflows/lint.yml | 60 | ||||
| -rw-r--r-- | .github/workflows/problem_matchers/selene.json | 30 | ||||
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | neovim.toml | 31 | ||||
| -rw-r--r-- | selene.toml | 5 |
5 files changed, 110 insertions, 20 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ce14ade8..5c9622bd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,24 +9,46 @@ jobs: lint: runs-on: [ubuntu-latest] steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Setup luacheck - run: | - sudo apt update && - sudo apt install -y lua5.1 luarocks && - sudo luarocks install luacheck - - name: Run luacheck - run: | - luacheck lua/* test/* + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Setup luacheck + run: | + sudo apt update + sudo apt install -y lua5.1 luarocks + sudo luarocks install luacheck + + - name: Setup selene + run: | + wget "https://github.com/Kampfkarren/selene/releases/download/$VERSION/selene-$VERSION-linux.zip" + echo "$SHA256_CHECKSUM selene-$VERSION-linux.zip" > "selene-$VERSION-linux.zip.checksum" + sha256sum --check "selene-$VERSION-linux.zip.checksum" + unzip "selene-$VERSION-linux.zip" + install -Dp selene "$HOME/.local/bin/selene" + + echo "::add-matcher::.github/workflows/problem_matchers/selene.json" + env: + VERSION: "0.15.0" + SHA256_CHECKSUM: "8ff9272170158fbd9c1af38206ecadc894dc456665dc9bd9f0d43a26e5e8f1af" + + - name: Add $HOME/.local/bin to $PATH + run: echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Run luacheck + run: luacheck lua/* test/* + + - name: Run selene + run: selene --display-style=quiet . + style-lint: runs-on: [ubuntu-latest] - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Lint with stylua - uses: JohnnyMorganz/stylua-action@1.0.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - # CLI arguments - args: --check . + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Lint with stylua + uses: JohnnyMorganz/stylua-action@1.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + # CLI arguments + args: --check . diff --git a/.github/workflows/problem_matchers/selene.json b/.github/workflows/problem_matchers/selene.json new file mode 100644 index 00000000..4bbf24f3 --- /dev/null +++ b/.github/workflows/problem_matchers/selene.json @@ -0,0 +1,30 @@ +{ + "problemMatcher": [ + { + "owner": "selene-error", + "severity": "error", + "pattern": [ + { + "regexp": "^([^:]+):(\\d+):(\\d+):\\serror(.*)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + ] + }, + { + "owner": "selene-warning", + "severity": "warning", + "pattern": [ + { + "regexp": "^([^:]+):(\\d+):(\\d+):\\swarning(.*)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + ] + } + ] +} @@ -1,10 +1,12 @@ test: sh ./scripts/run_test.sh + lint: @printf "\nRunning luacheck\n" luacheck lua/* test/* + @printf "\nRunning selene\n" + selene --display-style=quiet . @printf "\nRunning stylua\n" stylua --check . .PHONY: test lint - diff --git a/neovim.toml b/neovim.toml new file mode 100644 index 00000000..26ba9220 --- /dev/null +++ b/neovim.toml @@ -0,0 +1,31 @@ +[selene] +base = "lua51" +name = "neovim" + +[vim] +any = true + +[[assert.args]] +type = "bool" + +[[assert.args]] +type = "string" +required = false + +[[after_each.args]] +type = "function" + +[[before_each.args]] +type = "function" + +[[describe.args]] +type = "string" + +[[describe.args]] +type = "function" + +[[it.args]] +type = "string" + +[[it.args]] +type = "function" diff --git a/selene.toml b/selene.toml new file mode 100644 index 00000000..c85e792c --- /dev/null +++ b/selene.toml @@ -0,0 +1,5 @@ +std = "neovim" + +[rules] +global_usage = "allow" +multiple_statements = "allow" |
