Skip to content

Commit 925677d

Browse files
authored
chore: hardening code paths (#39)
* Harden storage and codify API contracts * add more linters * wrapping * lint fixes * address comments
1 parent a51d28b commit 925677d

27 files changed

Lines changed: 1363 additions & 289 deletions

.golangci.yml

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,76 @@ run:
55

66
linters:
77
enable:
8+
# complexity
89
- gocyclo
9-
- misspell
10+
11+
# correctness
1012
- bodyclose
13+
- errorlint
14+
- exhaustive
15+
- nilerr
16+
- noctx
17+
18+
# security
19+
- gosec
20+
21+
# performance
22+
- intrange
23+
- perfsprint
1124
- prealloc
25+
- unconvert
26+
27+
# code hygiene
28+
- goconst
29+
- misspell
30+
- protogetter
31+
- revive
32+
- unparam
33+
1234
settings:
1335
gocyclo:
1436
min-complexity: 15
37+
goconst:
38+
min-len: 3
39+
min-occurrences: 3
40+
exhaustive:
41+
default-signifies-exhaustive: true
42+
gosec:
43+
excludes:
44+
- G104 # unhandled errors — covered by errcheck (default linter)
45+
- G115 # integer overflow conversion — too noisy for blockchain height math
46+
- G304 # file inclusion via variable — expected for config loading
47+
- G306 # file permissions > 0600 — config templates, not secrets
48+
revive:
49+
rules:
50+
- name: blank-imports
51+
- name: context-as-argument
52+
- name: dot-imports
53+
- name: error-return
54+
- name: error-strings
55+
- name: error-naming
56+
- name: exported
57+
disabled: true
58+
- name: increment-decrement
59+
- name: var-naming
60+
- name: range
61+
- name: receiver-naming
62+
- name: indent-error-flow
63+
- name: empty-block
64+
- name: superfluous-else
65+
- name: unreachable-code
66+
- name: redefines-builtin-id
67+
1568
exclusions:
69+
rules:
70+
# Standard Go package names are fine for internal packages.
71+
- linters:
72+
- revive
73+
text: "avoid.*package names"
1674
paths:
1775
- vendor
76+
- ".*\\.pb\\.go$"
77+
- ".*\\.pb\\.gw\\.go$"
1878

1979
formatters:
2080
enable:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ just check # tidy + lint + test + build
4747
## Documentation
4848

4949
- [Running Apex](docs/running.md) -- setup, configuration, Docker, CLI
50+
- [API Compatibility Policy](docs/api-compat.md) -- JSON-RPC compatibility boundary vs gRPC evolution
5051

5152
## License
5253

0 commit comments

Comments
 (0)