Skip to content

Commit 084a7de

Browse files
committed
Add new make lint targets
1 parent d03f481 commit 084a7de

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

.golangci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@ run:
33

44
linters-settings:
55
goimports:
6+
# enforced by linter
67
# put imports beginning with prefix after 3rd-party packages;
78
# it's a comma-separated list of prefixes
89
local-prefixes: github.com/onflow/flow-go/
910

11+
# used to generate canonical import ordering
12+
# not enforced by linter
13+
gci:
14+
sections:
15+
- standard # 1. standard library
16+
- default # 2. external packages
17+
- prefix(github.com/onflow/) # 3. org packages
18+
- prefix(github.com/onflow/flow-go/) # 4. project packages
19+
skip-generated: true
20+
custom-order: true
21+
1022
gosec:
1123
# To select a subset of rules to run.
1224
# Available rules: https://github.com/securego/gosec#available-rules

AGENTS.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,18 @@ This file provides guidance to AI Agents when working with code in this reposito
5151
5252
### Code Quality and Generation
5353
- `make lint` - Run linter (includes tidy and custom checks)
54-
- `make lint -e LINT_PATH=./path/to/lint/...` - Run linter for a specific module
5554
- `make fix-lint` - Automatically fix linting issues
55+
- `make fix-imports` - Automatically fix imports
56+
- `make vet` - Run go vet
5657
- `make generate` - Run all code generators (proto, mocks, fvm wrappers)
5758
- `make generate-mocks` - Generate mocks for unit tests
5859
- `make generate-proto` - Generate protobuf stubs
5960
- `make tidy` - Run go mod tidy
6061
62+
`lint`, `vet`, `fix-lint`, and `fix-imports` support passing `LINT_PATH`, which sets the path used by golangci-lint
63+
- `make lint -e LINT_PATH=./path/to/lint/...` - Run linter for a specific module
64+
- `make lint -e LINT_PATH="./path/to/lint/file1.go ./path/to/lint/file2.go"` - Run linter for a set of paths
65+
6166
### Dependency Management
6267
- `make install-tools` - Install all required development tools
6368
- `make install-mock-generators` - Install mock generation tools

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ fix-lint:
257257
# revive -config revive.toml -exclude storage/ledger/trie ./...
258258
./tools/custom-gcl run -v --fix $(or $(LINT_PATH),./...)
259259

260+
.PHONY: fix-imports
261+
fix-imports:
262+
./tools/custom-gcl run --disable-all --enable=gci --fix $(or $(LINT_PATH),./...)
263+
264+
.PHONY: vet
265+
vet:
266+
./tools/custom-gcl run --disable-all --enable=govet $(or $(LINT_PATH),./...)
267+
260268
# Runs unit tests with different list of packages as passed by CI so they run in parallel
261269
.PHONY: ci
262270
ci: install-tools test

0 commit comments

Comments
 (0)