Skip to content

Commit e0f423b

Browse files
Thomas StrombergThomas Stromberg
authored andcommitted
update to sfcache, fix linting
1 parent 9048814 commit e0f423b

27 files changed

+440
-923
lines changed

.github/workflows/test.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v4
15+
- name: Checkout code
16+
uses: actions/checkout@v4
1717

18-
- name: Set up Go
19-
uses: actions/setup-go@v5
20-
with:
21-
go-version: '1.23'
22-
cache: true
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.23'
22+
cache: true
2323

24-
- name: Download dependencies
25-
run: go mod download
24+
- name: Download dependencies
25+
run: go mod download
2626

27-
- name: Run tests
28-
run: make test
27+
- name: Run tests
28+
run: make test
2929

30-
- name: Upload coverage to artifacts
31-
if: always()
32-
uses: actions/upload-artifact@v4
33-
with:
34-
name: coverage-report
35-
path: coverage.out
36-
retention-days: 30
30+
- name: Upload coverage to artifacts
31+
if: always()
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: coverage-report
35+
path: coverage.out
36+
retention-days: 30

.golangci.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ linters:
152152

153153
nakedret:
154154
# Default: 30
155-
max-func-lines: 4
155+
max-func-lines: 7
156156

157157
nestif:
158-
min-complexity: 12
158+
min-complexity: 15
159159

160160
nolintlint:
161161
# Exclude following linters from requiring an explanation.
@@ -171,17 +171,11 @@ linters:
171171
rules:
172172
- name: add-constant
173173
severity: warning
174-
disabled: false
175-
exclude: [""]
176-
arguments:
177-
- max-lit-count: "10"
178-
allow-strs: '"","\n","user","domain","ip"'
179-
allow-ints: "0,1,2,3,24,30,60,100,365,0o600,0o700,0o750,0o755"
180-
allow-floats: "0.0,0.,1.0,1.,2.0,2."
174+
disabled: true
181175
- name: cognitive-complexity
182-
arguments: [55]
176+
disabled: true # prefer maintidx
183177
- name: cyclomatic
184-
arguments: [60]
178+
disabled: true # prefer maintidx
185179
- name: function-length
186180
arguments: [150, 225]
187181
- name: line-length-limit
@@ -192,6 +186,8 @@ linters:
192186
arguments: [10]
193187
- name: flag-parameter # fixes are difficult
194188
disabled: true
189+
- name: bare-return
190+
disabled: true
195191

196192
rowserrcheck:
197193
# database/sql is always checked.
@@ -213,8 +209,14 @@ linters:
213209
os-temp-dir: true
214210

215211
varnamelen:
216-
max-distance: 40
212+
max-distance: 75
217213
min-name-length: 2
214+
check-receivers: false
215+
ignore-names:
216+
- r
217+
- w
218+
- f
219+
- err
218220

219221
exclusions:
220222
# Default: []

Makefile

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,28 @@ endif
3030
LINTERS :=
3131
FIXERS :=
3232

33+
SHELLCHECK_VERSION ?= v0.11.0
34+
SHELLCHECK_BIN := $(LINT_ROOT)/out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)
35+
$(SHELLCHECK_BIN):
36+
mkdir -p $(LINT_ROOT)/out/linters
37+
curl -sSfL -o $@.tar.xz https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION)/shellcheck-$(SHELLCHECK_VERSION).$(LINT_OS_LOWER).$(LINT_ARCH).tar.xz \
38+
|| echo "Unable to fetch shellcheck for $(LINT_OS)/$(LINT_ARCH): falling back to locally install"
39+
test -f $@.tar.xz \
40+
&& tar -C $(LINT_ROOT)/out/linters -xJf $@.tar.xz \
41+
&& mv $(LINT_ROOT)/out/linters/shellcheck-$(SHELLCHECK_VERSION)/shellcheck $@ \
42+
|| printf "#!/usr/bin/env shellcheck\n" > $@
43+
chmod u+x $@
44+
45+
LINTERS += shellcheck-lint
46+
shellcheck-lint: $(SHELLCHECK_BIN)
47+
$(SHELLCHECK_BIN) $(shell find . -name "*.sh")
48+
49+
FIXERS += shellcheck-fix
50+
shellcheck-fix: $(SHELLCHECK_BIN)
51+
$(SHELLCHECK_BIN) $(shell find . -name "*.sh") -f diff | { read -t 1 line || exit 0; { echo "$$line" && cat; } | git apply -p2; }
52+
3353
GOLANGCI_LINT_CONFIG := $(LINT_ROOT)/.golangci.yml
34-
GOLANGCI_LINT_VERSION ?= v2.3.0
54+
GOLANGCI_LINT_VERSION ?= v2.7.2
3555
GOLANGCI_LINT_BIN := $(LINT_ROOT)/out/linters/golangci-lint-$(GOLANGCI_LINT_VERSION)-$(LINT_ARCH)
3656
$(GOLANGCI_LINT_BIN):
3757
mkdir -p $(LINT_ROOT)/out/linters
@@ -61,9 +81,19 @@ yamllint-lint: $(YAMLLINT_BIN)
6181
PYTHONPATH=$(YAMLLINT_ROOT)/dist $(YAMLLINT_ROOT)/dist/bin/yamllint .
6282

6383
.PHONY: _lint $(LINTERS)
64-
_lint: $(LINTERS)
84+
_lint:
85+
@exit_code=0; \
86+
for target in $(LINTERS); do \
87+
$(MAKE) $$target || exit_code=1; \
88+
done; \
89+
exit $$exit_code
6590

6691
.PHONY: fix $(FIXERS)
67-
fix: $(FIXERS)
92+
fix:
93+
@exit_code=0; \
94+
for target in $(FIXERS); do \
95+
$(MAKE) $$target || exit_code=1; \
96+
done; \
97+
exit $$exit_code
6898

6999
# END: lint-install .

go.mod

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
module github.com/codeGROOVE-dev/prx
22

3-
go 1.23.4
3+
go 1.25.4
44

5-
require github.com/codeGROOVE-dev/retry v1.3.0
5+
require (
6+
github.com/codeGROOVE-dev/retry v1.3.0
7+
github.com/codeGROOVE-dev/sfcache v1.3.0
8+
github.com/codeGROOVE-dev/sfcache/pkg/persist/localfs v1.3.0
9+
)

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
github.com/codeGROOVE-dev/retry v1.3.0 h1:/+ipAWRJLL6y1R1vprYo0FSjSBvH6fE5j9LKXjpD54g=
22
github.com/codeGROOVE-dev/retry v1.3.0/go.mod h1:8OgefgV1XP7lzX2PdKlCXILsYKuz6b4ZpHa/20iLi8E=
3+
github.com/codeGROOVE-dev/sfcache v1.3.0 h1:Ew900GWXkZhMEU560kz0Nk1HvhGshiqaIASbTH+ihHg=
4+
github.com/codeGROOVE-dev/sfcache v1.3.0/go.mod h1:ksV5Y1RwKmOPZZiV0zXpsBOENGUCgO0fVgr/P8f/DJM=
5+
github.com/codeGROOVE-dev/sfcache/pkg/persist/localfs v1.3.0 h1:7zKbd7aHVzmbK2eEbdsf6Dknrte/o8+7I6GkNob8bGA=
6+
github.com/codeGROOVE-dev/sfcache/pkg/persist/localfs v1.3.0/go.mod h1:vHDjjehmi+yjXD+DXVG0rnc4iOBsiIknLThqpkYwA/c=

0 commit comments

Comments
 (0)