@@ -25,16 +25,15 @@ COMMA := ,
25
25
26
26
XGO_VERSION := go-1.20.x
27
27
28
- AIR_PACKAGE ?= github.com/cosmtrek/air@v1.40.4
29
- EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.6.0
30
- ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.2
31
- GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
32
- GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
33
- GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
28
+ AIR_PACKAGE ?= github.com/cosmtrek/air@v1.43.0
29
+ EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.7.0
30
+ GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.5.0
31
+ GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
32
+ GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11
34
33
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
35
34
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.4
36
35
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
37
- GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.5 .0
36
+ GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6 .0
38
37
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest
39
38
40
39
DOCKER_IMAGE ?= gitea/gitea
@@ -194,9 +193,20 @@ help:
194
193
@echo " - deps-backend install backend dependencies"
195
194
@echo " - deps-tools install tool dependencies"
196
195
@echo " - lint lint everything"
196
+ @echo " - lint-fix lint everything and fix issues"
197
197
@echo " - lint-frontend lint frontend files"
198
+ @echo " - lint-frontend-fix lint frontend files and fix issues"
198
199
@echo " - lint-backend lint backend files"
200
+ @echo " - lint-backend-fix lint backend files and fix issues"
201
+ @echo " - lint-go lint go files"
202
+ @echo " - lint-go-fix lint go files and fix issues"
203
+ @echo " - lint-go-vet lint go files with vet"
204
+ @echo " - lint-js lint js files"
205
+ @echo " - lint-js-fix lint js files and fix issues"
206
+ @echo " - lint-css lint css files"
207
+ @echo " - lint-css-fix lint css files and fix issues"
199
208
@echo " - lint-md lint markdown files"
209
+ @echo " - lint-swagger lint swagger files"
200
210
@echo " - checks run various consistency checks"
201
211
@echo " - checks-frontend check frontend files"
202
212
@echo " - checks-backend check backend files"
@@ -214,9 +224,7 @@ help:
214
224
@echo " - generate-manpage generate manpage"
215
225
@echo " - generate-swagger generate the swagger spec from code comments"
216
226
@echo " - swagger-validate check if the swagger spec is valid"
217
- @echo " - golangci-lint run golangci-lint linter"
218
227
@echo " - go-licenses regenerate go licenses"
219
- @echo " - vet examines Go source code and reports suspicious constructs"
220
228
@echo " - tidy run go mod tidy"
221
229
@echo " - test[\#TestSpecificName] run unit test"
222
230
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite"
@@ -286,12 +294,6 @@ fmt-check: fmt
286
294
misspell-check :
287
295
go run $(MISSPELL_PACKAGE ) -error $(GO_DIRS ) $(WEB_DIRS )
288
296
289
- .PHONY : vet
290
- vet :
291
- @echo " Running go vet..."
292
- @GOOS= GOARCH= $(GO ) build code.gitea.io/gitea-vet
293
- @$(GO ) vet -vettool=gitea-vet $(GO_PACKAGES )
294
-
295
297
.PHONY : $(TAGS_EVIDENCE )
296
298
$(TAGS_EVIDENCE ) :
297
299
@mkdir -p $(MAKE_EVIDENCE_DIR )
@@ -324,11 +326,6 @@ swagger-validate:
324
326
$(GO ) run $(SWAGGER_PACKAGE ) validate ' ./$(SWAGGER_SPEC)'
325
327
$(SED_INPLACE ) ' $(SWAGGER_SPEC_S_TMPL)' ' ./$(SWAGGER_SPEC)'
326
328
327
- .PHONY : errcheck
328
- errcheck :
329
- @echo " Running errcheck..."
330
- $(GO ) run $(ERRCHECK_PACKAGE ) $(GO_PACKAGES )
331
-
332
329
.PHONY : checks
333
330
checks : checks-frontend checks-backend
334
331
@@ -341,18 +338,69 @@ checks-backend: tidy-check swagger-check fmt-check misspell-check swagger-valida
341
338
.PHONY : lint
342
339
lint : lint-frontend lint-backend
343
340
341
+ .PHONY : lint-fix
342
+ lint-fix : lint-frontend-fix lint-backend-fix
343
+
344
344
.PHONY : lint-frontend
345
- lint-frontend : node_modules lint-md
345
+ lint-frontend : lint-js lint-css lint-md lint-swagger
346
+
347
+ .PHONY : lint-frontend-fix
348
+ lint-frontend-fix : lint-js-fix lint-css-fix lint-md lint-swagger
349
+
350
+ .PHONY : lint-backend
351
+ lint-backend : lint-go lint-go-vet lint-editorconfig
352
+
353
+ .PHONY : lint-backend-fix
354
+ lint-backend-fix : lint-go-fix lint-go-vet lint-editorconfig
355
+
356
+ .PHONY : lint-js
357
+ lint-js : node_modules
346
358
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build * .config.js docs/assets/js tests/e2e
359
+
360
+ .PHONY : lint-js-fix
361
+ lint-js-fix : node_modules
362
+ npx eslint --color --max-warnings=0 --ext js,vue web_src/js build * .config.js docs/assets/js tests/e2e --fix
363
+
364
+ .PHONY : lint-css
365
+ lint-css : node_modules
347
366
npx stylelint --color --max-warnings=0 web_src/css
367
+
368
+ .PHONY : lint-css-fix
369
+ lint-css-fix : node_modules
370
+ npx stylelint --color --max-warnings=0 web_src/css --fix
371
+
372
+ .PHONY : lint-swagger
373
+ lint-swagger : node_modules
348
374
npx spectral lint -q -F hint $(SWAGGER_SPEC )
349
375
350
376
.PHONY : lint-md
351
377
lint-md : node_modules
352
378
npx markdownlint docs * .md
353
379
354
- .PHONY : lint-backend
355
- lint-backend : golangci-lint vet editorconfig-checker
380
+ .PHONY : lint-go
381
+ lint-go :
382
+ $(GO ) run $(GOLANGCI_LINT_PACKAGE ) run
383
+
384
+ .PHONY : lint-go-fix
385
+ lint-go-fix :
386
+ $(GO ) run $(GOLANGCI_LINT_PACKAGE ) run --fix
387
+
388
+ # workaround step for the lint-backend-windows CI task because 'go run' can not
389
+ # have distinct GOOS/GOARCH for its build and run steps
390
+ .PHONY : lint-go-windows
391
+ lint-go-windows :
392
+ @GOOS= GOARCH= $(GO ) install $(GOLANGCI_LINT_PACKAGE )
393
+ golangci-lint run
394
+
395
+ .PHONY : lint-go-vet
396
+ lint-go-vet :
397
+ @echo " Running go vet..."
398
+ @GOOS= GOARCH= $(GO ) build code.gitea.io/gitea-vet
399
+ @$(GO ) vet -vettool=gitea-vet $(GO_PACKAGES )
400
+
401
+ .PHONY : lint-editorconfig
402
+ lint-editorconfig :
403
+ $(GO ) run $(EDITORCONFIG_CHECKER_PACKAGE ) templates
356
404
357
405
.PHONY : watch
358
406
watch :
@@ -843,7 +891,6 @@ deps-backend:
843
891
deps-tools :
844
892
$(GO ) install $(AIR_PACKAGE )
845
893
$(GO ) install $(EDITORCONFIG_CHECKER_PACKAGE )
846
- $(GO ) install $(ERRCHECK_PACKAGE )
847
894
$(GO ) install $(GOFUMPT_PACKAGE )
848
895
$(GO ) install $(GOLANGCI_LINT_PACKAGE )
849
896
$(GO ) install $(GXZ_PAGAGE )
@@ -942,21 +989,6 @@ generate-manpage:
942
989
@gzip -9 man/man1/gitea.1 && echo man/man1/gitea.1.gz created
943
990
@# TODO A small script that formats config-cheat-sheet.en-us.md nicely for use as a config man page
944
991
945
- .PHONY : golangci-lint
946
- golangci-lint :
947
- $(GO ) run $(GOLANGCI_LINT_PACKAGE ) run
948
-
949
- # workaround step for the lint-backend-windows CI task because 'go run' can not
950
- # have distinct GOOS/GOARCH for its build and run steps
951
- .PHONY : golangci-lint-windows
952
- golangci-lint-windows :
953
- @GOOS= GOARCH= $(GO ) install $(GOLANGCI_LINT_PACKAGE )
954
- golangci-lint run
955
-
956
- .PHONY : editorconfig-checker
957
- editorconfig-checker :
958
- $(GO ) run $(EDITORCONFIG_CHECKER_PACKAGE ) templates
959
-
960
992
.PHONY : docker
961
993
docker :
962
994
docker build --disable-content-trust=false -t $(DOCKER_REF ) .
0 commit comments