Browse Source

ci: introduce revive check into ci (#1735)

* introduce revive into ci

Signed-off-by: yisaer <disxiaofei@163.com>

* fix

Signed-off-by: yisaer <disxiaofei@163.com>

---------

Signed-off-by: yisaer <disxiaofei@163.com>
Song Gao 2 years ago
parent
commit
899026914b
2 changed files with 41 additions and 1 deletions
  1. 40 0
      .github/workflows/lint.yaml
  2. 1 1
      tools/check/revive.toml

+ 40 - 0
.github/workflows/lint.yaml

@@ -0,0 +1,40 @@
+name: Lint
+on:
+  push:
+    paths:
+      - '**.go'
+      - 'go.mod'
+      - 'go.sum'
+      - 'tools/check/revive.toml'
+      - '.github/workflows/lint.yaml'
+  pull_request:
+    types: [opened, edited, synchronize, reopened]
+    paths:
+      - '**.go'
+      - 'go.mod'
+      - 'go.sum'
+      - 'tools/check/revive.toml'
+      - '.github/workflows/lint.yaml'
+
+jobs:
+
+  lint:
+    name: Lint
+    runs-on: ubuntu-latest
+    steps:
+
+      - name: Set up Go
+        uses: actions/setup-go@v4
+        with:
+          go-version: '1.20'
+
+      - name: Check out code into the Go module directory
+        uses: actions/checkout@v3
+
+      - name: Run Revive Action
+        uses: docker://morphy/revive-action:v2
+        with:
+          config: tools/check/revive.toml
+
+      - name: Check formatting
+        run: test -z $(gofmt -l .) || (gofmt -l . && exit 1)

+ 1 - 1
tools/check/revive.toml

@@ -13,7 +13,7 @@ warningCode = -1
 #[rule.exported]
 #[rule.if-return]
 #[rule.var-naming]
-[rule.package-comments]
+#[rule.package-comments]
 #[rule.range]
 #[rule.receiver-naming]
 #[rule.indent-error-flow]