7cd0583487cd9573270d2dc0c1700a6839ac1601

Author
Ayman Bagabas <ayman.bagabas@gmail.com>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

fix(ci): golangci linter

Add soft lint

Diff

  1diff --git a/.github/workflows/lint-soft.yml b/.github/workflows/lint-soft.yml
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..6230528921e4e21c75095898bab53d00d9de0564
  4--- /dev/null
  5+++ b/.github/workflows/lint-soft.yml
  6@@ -0,0 +1,28 @@
  7+name: lint-soft
  8+on:
  9+  push:
 10+  pull_request:
 11+
 12+permissions:
 13+  contents: read
 14+  # Optional: allow read access to pull request. Use with `only-new-issues` option.
 15+  pull-requests: read
 16+
 17+jobs:
 18+  golangci:
 19+    name: lint-soft
 20+    runs-on: ubuntu-latest
 21+    steps:
 22+      - name: Install Go
 23+        uses: actions/setup-go@v4
 24+        with:
 25+          go-version: ^1
 26+
 27+      - uses: actions/checkout@v3
 28+      - name: golangci-lint
 29+        uses: golangci/golangci-lint-action@v3
 30+        with:
 31+          # Optional: golangci-lint command line arguments.
 32+          args: --config .golangci-soft.yml --issues-exit-code=0
 33+          # Optional: show only new issues if it's a pull request. The default value is `false`.
 34+          only-new-issues: true
 35diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
 36index 5e96efe53fb66c29a6ac89df81161e106f870f95..2f26b2ac2ac7f20664f0fc627649496267125846 100644
 37--- a/.github/workflows/lint.yml
 38+++ b/.github/workflows/lint.yml
 39@@ -3,19 +3,26 @@ on:
 40   push:
 41   pull_request:
 42 
 43+permissions:
 44+  contents: read
 45+  # Optional: allow read access to pull request. Use with `only-new-issues` option.
 46+  pull-requests: read
 47+
 48 jobs:
 49   golangci:
 50     name: lint
 51     runs-on: ubuntu-latest
 52     steps:
 53-      - uses: actions/checkout@v3
 54-      - uses: actions/setup-go@v4
 55+      - name: Install Go
 56+        uses: actions/setup-go@v4
 57         with:
 58           go-version: ^1
 59+
 60+      - uses: actions/checkout@v3
 61       - name: golangci-lint
 62         uses: golangci/golangci-lint-action@v3
 63         with:
 64           # Optional: golangci-lint command line arguments.
 65-          args: --issues-exit-code=0
 66+          #args:
 67           # Optional: show only new issues if it's a pull request. The default value is `false`.
 68           only-new-issues: true
 69diff --git a/.golangci-soft.yml b/.golangci-soft.yml
 70new file mode 100644
 71index 0000000000000000000000000000000000000000..ef456e0605919f959a254d6dbe917b5d26f7ffcd
 72--- /dev/null
 73+++ b/.golangci-soft.yml
 74@@ -0,0 +1,47 @@
 75+run:
 76+  tests: false
 77+
 78+issues:
 79+  include:
 80+    - EXC0001
 81+    - EXC0005
 82+    - EXC0011
 83+    - EXC0012
 84+    - EXC0013
 85+
 86+  max-issues-per-linter: 0
 87+  max-same-issues: 0
 88+
 89+linters:
 90+  enable:
 91+    # - dupl
 92+    - exhaustive
 93+    # - exhaustivestruct
 94+    - goconst
 95+    - godot
 96+    - godox
 97+    - gomnd
 98+    - gomoddirectives
 99+    - goprintffuncname
100+    - ifshort
101+    # - lll
102+    - misspell
103+    - nakedret
104+    - nestif
105+    - noctx
106+    - nolintlint
107+    - prealloc
108+    - wrapcheck
109+
110+  # disable default linters, they are already enabled in .golangci.yml
111+  disable:
112+    - deadcode
113+    - errcheck
114+    - gosimple
115+    - govet
116+    - ineffassign
117+    - staticcheck
118+    - structcheck
119+    - typecheck
120+    - unused
121+    - varcheck
122diff --git a/.golangci.yml b/.golangci.yml
123index 2be31f224cec995b4ec2681aca3c1d76b9252e87..a5a91d0d91348545ae21ac105126432198795697 100644
124--- a/.golangci.yml
125+++ b/.golangci.yml
126@@ -15,19 +15,15 @@ issues:
127 linters:
128   enable:
129     - bodyclose
130-    - dupl
131     - exportloopref
132-    - goconst
133-    - godot
134-    - godox
135     - goimports
136-    - goprintffuncname
137     - gosec
138-    - misspell
139-    - prealloc
140+    - nilerr
141+    - predeclared
142     - revive
143     - rowserrcheck
144     - sqlclosecheck
145+    - tparallel
146     - unconvert
147     - unparam
148     - whitespace