Skip to content

Commit 262f080

Browse files
committed
fix: lint issues
1 parent 33eea19 commit 262f080

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2473
-1916
lines changed

.github/workflows/lint.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
golangci-lint:
11+
name: golangci-lint
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: "1.24.0"
23+
24+
- name: Run golangci-lint
25+
uses: golangci/golangci-lint-action@v4
26+
with:
27+
version: v2

.golangci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: "2"
2+
linters:
3+
enable:
4+
- errcheck
5+
- govet
6+
- ineffassign
7+
- staticcheck
8+
- unused
9+
formatters:
10+
enable:
11+
- gci
12+
- gofmt
13+
- gofumpt
14+
- goimports
15+
- golines
16+
- swaggo

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"go.lintTool": "golangci-lint-v2",
3+
"go.lintFlags": ["--path-mode=abs", "--fast-only"],
4+
"go.formatTool": "custom",
5+
"go.alternateTools": {
6+
"customFormatter": "golangci-lint-v2"
7+
},
8+
"go.formatFlags": ["fmt", "--stdin"]
9+
}

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Agent Smith
22
[![Test](https://github.com/RewstApp/agent-smith-go/actions/workflows/test.yml/badge.svg)](https://github.com/RewstApp/agent-smith-go/actions/workflows/test.yml)
33
[![Coverage](https://github.com/RewstApp/agent-smith-go/actions/workflows/coverage.yml/badge.svg)](https://github.com/RewstApp/agent-smith-go/actions/workflows/coverage.yml)
4+
[![Lint](https://github.com/RewstApp/agent-smith-go/actions/workflows/lint.yml/badge.svg)](https://github.com/RewstApp/agent-smith-go/actions/workflows/lint.yml)
45
[![CodeQL](https://github.com/RewstApp/agent-smith-go/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/RewstApp/agent-smith-go/actions/workflows/github-code-scanning/codeql)
56
[![Release](https://github.com/RewstApp/agent-smith-go/actions/workflows/release.yml/badge.svg)](https://github.com/RewstApp/agent-smith-go/actions/workflows/release.yml)
67

@@ -201,8 +202,35 @@ Tests run automatically on:
201202
**Pull requests must:**
202203
- ✅ Pass all tests
203204
- ✅ Maintain ≥80% coverage
205+
- ✅ Pass all linters
204206
- ✅ Pass CodeQL security scanning
205207

208+
## Code Quality and Linting
209+
210+
Agent Smith uses [golangci-lint](https://golangci-lint.run/) for strict security and code formatting enforcement.
211+
212+
### Running Locally
213+
214+
#### **Install golangci-lint:**
215+
216+
See this [guide](https://golangci-lint.run/docs/welcome/install/local/) to learn how to install golangci-lint on your local machine.
217+
218+
#### **Run linter:**
219+
```bash
220+
golangci-lint run
221+
```
222+
223+
#### **Auto-fix formatting:**
224+
```bash
225+
golangci-lint run --fix
226+
```
227+
228+
### CI/CD
229+
230+
Linting runs automatically on:
231+
- Every pull request
232+
- Every push to main branch
233+
206234
## Contributing
207235
Contributions are always welcome. Please submit a PR!
208236

@@ -214,4 +242,4 @@ cz commit
214242

215243
## License
216244

217-
Agent Smith is licensed under `GNU GENERAL PUBLIC LICENSE`. See license file for details.
245+
Agent Smith is licensed under `GNU GENERAL PUBLIC LICENSE`. See license file for details.

0 commit comments

Comments
 (0)