Skip to content

Commit ed82bcb

Browse files
Copilotcschleiden
andcommitted
Add comprehensive linting instructions to AGENTS.md
Co-authored-by: cschleiden <[email protected]>
1 parent 0d07083 commit ed82bcb

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

AGENTS.md

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,49 @@ go test -timeout 120s -race -count 1 -v ./... 2>&1 | go-junit-report -set-exit-c
3636
```
3737

3838
### Linting
39+
40+
The project uses golangci-lint v2 with a custom analyzer plugin for workflow code validation. There are multiple ways to run the linter:
41+
42+
#### Recommended: Using Makefile (Preferred)
3943
```bash
40-
# Install golangci-lint
41-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
44+
# Run the full linter suite with custom analyzer - Takes ~12-15 seconds.
45+
make lint
46+
```
4247

43-
# Build custom analyzer plugin - Takes ~8 seconds.
44-
go build -tags analyzerplugin -buildmode=plugin analyzer/plugin/plugin.go
48+
This will:
49+
- Check if golangci-lint is installed
50+
- Build the custom analyzer plugin
51+
- Run all configured linters from `.golangci.yml`
52+
53+
#### Manual Setup
54+
If you need to install golangci-lint or run it manually:
55+
56+
```bash
57+
# Install golangci-lint v2 (required for this project)
58+
go install github.com/golangci/golangci-lint/v2/cmd/[email protected]
4559

46-
# Run basic linting (custom analyzer has version conflicts) - Takes ~12 seconds.
47-
~/go/bin/golangci-lint run --disable-all --enable=gofmt,govet,ineffassign,misspell --timeout=5m
60+
# Run the full linter configuration - Takes ~12-15 seconds.
61+
golangci-lint run --timeout=5m
4862
```
4963

64+
**Note:** The project uses golangci-lint v2.4.0 configuration. Version v1.x will not work with the `.golangci.yml` configuration file.
65+
66+
#### Workaround: Basic Linting (When Custom Analyzer Has Issues)
67+
If the custom analyzer has version compatibility issues:
68+
69+
```bash
70+
# Run basic linting without custom analyzer - Takes ~12 seconds.
71+
golangci-lint run --disable-all --enable=gofmt,govet,ineffassign,misspell --timeout=5m
72+
```
73+
74+
#### Available Linters
75+
The `.golangci.yml` configuration enables multiple linters including:
76+
- **Code Quality**: staticcheck, unused, ineffassign, wastedassign
77+
- **Bug Detection**: govet, makezero, prealloc, predeclared
78+
- **Style & Formatting**: gofmt, whitespace, tagalign
79+
- **Testing**: testifylint, tparallel
80+
- **Custom**: goworkflows (workflow-specific validation, currently commented out)
81+
5082
### Sample Applications
5183
```bash
5284
# Simple workflow example with Redis backend (default)
@@ -94,8 +126,9 @@ Run these validation steps before committing changes:
94126

95127
1. **Full Build:** `go build -v ./...` - Must complete without errors
96128
2. **Short Tests:** `go test -short -timeout 120s -race -count 1 -v ./...` - Should pass (1 known non-critical test failure in tester package)
97-
3. **Sample Execution:** At least one sample must run successfully
98-
4. **Basic Linting:** Check for obvious issues with basic linters
129+
3. **Linting:** `make lint` or `golangci-lint run --timeout=5m` - Should pass with no new violations
130+
4. **Code Formatting:** `make fmt` - Ensure code is properly formatted
131+
5. **Sample Execution:** At least one sample must run successfully
99132

100133
### Manual Testing Scenarios
101134
Execute these scenarios to verify workflow functionality:

0 commit comments

Comments
 (0)