memos/.golangci.yaml

86 lines
2.1 KiB
YAML
Raw Normal View History

run:
timeout: 10m
2022-08-24 21:53:12 +08:00
linters:
enable:
2023-09-17 22:55:13 +08:00
- errcheck
2022-08-24 21:53:12 +08:00
- goimports
- revive
- govet
- staticcheck
- misspell
- gocritic
- sqlclosecheck
- rowserrcheck
- nilerr
- godot
2023-09-17 22:55:13 +08:00
- forbidigo
- mirror
- bodyclose
2022-08-24 21:53:12 +08:00
issues:
2023-09-17 22:55:13 +08:00
include:
# https://golangci-lint.run/usage/configuration/#command-line-options
2022-08-24 21:53:12 +08:00
exclude:
- Rollback
2023-09-17 22:55:13 +08:00
- logger.Sync
- pgInstance.Stop
- fmt.Printf
2023-09-17 22:55:13 +08:00
- Enter(.*)_(.*)
- Exit(.*)_(.*)
2022-08-24 21:53:12 +08:00
linters-settings:
2023-09-17 22:55:13 +08:00
goimports:
# Put imports beginning with prefix after 3rd-party packages.
local-prefixes: github.com/usememos/memos
2022-08-24 21:53:12 +08:00
revive:
2023-09-17 22:55:13 +08:00
# Default to run all linters so that new rules in the future could automatically be added to the static check.
2022-08-24 21:53:12 +08:00
enable-all-rules: true
rules:
2023-09-17 22:55:13 +08:00
# The following rules are too strict and make coding harder. We do not enable them for now.
2022-08-24 21:53:12 +08:00
- name: file-header
disabled: true
- name: line-length-limit
disabled: true
- name: function-length
disabled: true
- name: max-public-structs
disabled: true
- name: function-result-limit
disabled: true
- name: banned-characters
disabled: true
- name: argument-limit
disabled: true
- name: cognitive-complexity
disabled: true
- name: cyclomatic
disabled: true
- name: confusing-results
disabled: true
- name: add-constant
disabled: true
- name: flag-parameter
disabled: true
- name: nested-structs
disabled: true
- name: import-shadowing
disabled: true
- name: early-return
disabled: true
gocritic:
disabled-checks:
- ifElseChain
govet:
settings:
2023-09-17 22:55:13 +08:00
printf: # The name of the analyzer, run `go tool vet help` to see the list of all analyzers
funcs: # Run `go tool vet help printf` to see the full configuration of `printf`.
2022-08-24 21:53:12 +08:00
- common.Errorf
2023-09-17 22:55:13 +08:00
enable-all: true
disable:
- fieldalignment
- shadow
2022-08-24 21:53:12 +08:00
forbidigo:
forbid:
- 'fmt\.Errorf(# Please use errors\.Wrap\|Wrapf\|Errorf instead)?'
2023-09-17 22:55:13 +08:00
- 'ioutil\.ReadDir(# Please use os\.ReadDir)?'