mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-11 16:24:11 +01:00
CI: Add revive.toml & "make lint-go" target, improve .golangci.yml #5330
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -19,3 +19,56 @@ linters:
|
||||
- mnd # don't go after every "magic number"
|
||||
- depguard # only useful once you define strict dependency rules
|
||||
- gomodguard
|
||||
- ineffassign
|
||||
- errcheck
|
||||
|
||||
settings:
|
||||
revive:
|
||||
# Only enable the revive rules you actually care about.
|
||||
rules:
|
||||
- name: blank-imports
|
||||
- name: error-strings
|
||||
- name: error-return
|
||||
- name: error-naming
|
||||
- name: exported
|
||||
- name: if-return
|
||||
- name: var-naming
|
||||
severity: warning
|
||||
disabled: false
|
||||
exclude: [""]
|
||||
arguments:
|
||||
- ["ID", "Id", "id", "UID", "Uid", "uid", "URI", "Uri", "uri", "URL", "Url", "url"] # AllowList
|
||||
- [] # DenyList
|
||||
- - skip-initialism-name-checks: true
|
||||
upper-case-const: true
|
||||
skip-package-name-checks: true
|
||||
- name: var-declaration
|
||||
- name: increment-decrement
|
||||
- name: range
|
||||
- name: receiver-naming
|
||||
- name: time-naming
|
||||
- name: unexported-return
|
||||
|
||||
misspell:
|
||||
# Correct spellings using locale preferences for US or UK.
|
||||
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
|
||||
# Default is to use a neutral variety of English.
|
||||
locale: US
|
||||
# Typos to ignore.
|
||||
# Should be in lower case.
|
||||
# Default: []
|
||||
ignore-rules:
|
||||
- nolint
|
||||
- gosec
|
||||
# Extra word corrections.
|
||||
# `typo` and `correction` should only contain letters.
|
||||
# The words are case-insensitive.
|
||||
# Default: []
|
||||
extra-words:
|
||||
- typo: "Photoprism"
|
||||
correction: "PhotoPrism"
|
||||
# Mode of the analysis:
|
||||
# - default: checks all the file content.
|
||||
# - restricted: checks only comments.
|
||||
# Default: ""
|
||||
mode: restricted
|
||||
|
||||
7
Makefile
7
Makefile
@@ -936,8 +936,13 @@ docker-dummy-oidc:
|
||||
packer-digitalocean:
|
||||
$(info Buildinng DigitalOcean marketplace image...)
|
||||
(cd ./setup/docker/cloud && packer build digitalocean.json)
|
||||
lint: lint-js lint-go
|
||||
lint-js:
|
||||
(cd frontend && npm run lint)
|
||||
$(info Linting JS code...)
|
||||
$(MAKE) -C frontend lint
|
||||
lint-go:
|
||||
$(info Linting Go code...)
|
||||
golangci-lint run --issues-exit-code 0 ./pkg/... ./internal/... ./.../internal/...
|
||||
fmt-js:
|
||||
(cd frontend && npm run fmt)
|
||||
fmt-go:
|
||||
|
||||
@@ -60,7 +60,7 @@ watch:
|
||||
build:
|
||||
npm run build
|
||||
lint:
|
||||
npm run lint
|
||||
npm run lint || true
|
||||
fmt:
|
||||
npm run fmt
|
||||
test:
|
||||
|
||||
34
revive.toml
Normal file
34
revive.toml
Normal file
@@ -0,0 +1,34 @@
|
||||
ignoreGeneratedHeader = false
|
||||
severity = "warning"
|
||||
confidence = 0.8
|
||||
errorCode = 0
|
||||
warningCode = 0
|
||||
|
||||
[rule.blank-imports]
|
||||
[rule.context-as-argument]
|
||||
[rule.context-keys-type]
|
||||
[rule.dot-imports]
|
||||
[rule.error-return]
|
||||
[rule.error-strings]
|
||||
[rule.error-naming]
|
||||
[rule.exported]
|
||||
[rule.increment-decrement]
|
||||
[rule.var-naming]
|
||||
arguments = [
|
||||
["ID", "Id", "id", "UID", "Uid", "uid", "URI", "Uri", "uri", "URL", "Url", "url"],
|
||||
[],
|
||||
[{ skip-initialism-name-checks = true, upper-case-const = true, skip-package-name-checks = true }]
|
||||
]
|
||||
[rule.var-declaration]
|
||||
[rule.package-comments]
|
||||
[rule.range]
|
||||
[rule.receiver-naming]
|
||||
[rule.time-naming]
|
||||
[rule.unexported-return]
|
||||
[rule.indent-error-flow]
|
||||
[rule.errorf]
|
||||
[rule.empty-block]
|
||||
[rule.superfluous-else]
|
||||
[rule.unused-parameter]
|
||||
[rule.unreachable-code]
|
||||
[rule.redefines-builtin-id]
|
||||
Reference in New Issue
Block a user