
Some checks failed
Deploy Production / Deploy to Staging (push) Has been skipped
Go Linter / Run golangci-lint (api_gateway) (push) Failing after 6m41s
Go Linter / Build golang services (api_gateway) (push) Has been skipped
Go Linter / Push Docker Images (api_gateway) (push) Has been skipped
247 lines
11 KiB
YAML
247 lines
11 KiB
YAML
# Options for analysis running.
|
||
run:
|
||
# The default concurrency value is the number of available CPU.
|
||
concurrency: 2
|
||
# Timeout for analysis, e.g. 30s, 5m.
|
||
# Default: 1m
|
||
timeout: 5m
|
||
# Exit code when at least one issue was found.
|
||
# Default: 1
|
||
issues-exit-code: 1
|
||
# Include test files or not.
|
||
# Default: true
|
||
tests: false
|
||
# List of build tags, all linters use it.
|
||
# Default: [].
|
||
build-tags: [ ]
|
||
# Which files to skip: they will be analyzed, but issues from them won't be reported.
|
||
# Default value is empty list,
|
||
# but there is no need to include all autogenerated files,
|
||
# we confidently recognize autogenerated files.
|
||
# If it's not please let us know.
|
||
# "/" will be replaced by current OS file path separator to properly work on Windows.
|
||
skip-files: [ ] # сгенерированные файлы пропускаются автоматически
|
||
# If set we pass it to "go list -mod={option}". From "go help modules":
|
||
# If invoked with -mod=readonly, the go command is disallowed from the implicit
|
||
# automatic updating of go.mod described above. Instead, it fails when any changes
|
||
# to go.mod are needed. This setting is most useful to check that go.mod does
|
||
# not need updates, such as in a continuous integration and testing system.
|
||
# If invoked with -mod=vendor, the go command assumes that the vendor
|
||
# directory holds the correct copies of dependencies and ignores
|
||
# the dependency descriptions in go.mod.
|
||
#
|
||
# Allowed values: readonly|vendor|mod
|
||
# By default, it isn't set.
|
||
modules-download-mode: readonly
|
||
# Allow multiple parallel golangci-lint instances running.
|
||
# If false (default) - golangci-lint acquires file lock on start.
|
||
allow-parallel-runners: true
|
||
|
||
# Минимально поддерживаемая версия go.
|
||
# Mainly related to generics support in go1.18.
|
||
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17
|
||
go: '1.22'
|
||
|
||
# output configuration options
|
||
output:
|
||
# Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
|
||
#
|
||
# Multiple can be specified by separating them by comma, output can be provided
|
||
# for each of them by separating format name and path by colon symbol.
|
||
# Output path can be either `stdout`, `stderr` or path to the file to write to.
|
||
# Example: "checkstyle:report.json,colored-line-number"
|
||
#
|
||
# Default: colored-line-number
|
||
formats: "colored-line-number:stdout,code-climate:code-quality-report.json"
|
||
# Print lines of code with issue.
|
||
# Default: true
|
||
print-issued-lines: false
|
||
# Print linter name in the end of issue text.
|
||
# Default: true
|
||
print-linter-name: true
|
||
# Make issues output unique by line.
|
||
# Default: true
|
||
uniq-by-line: true
|
||
# Add a prefix to the output file references.
|
||
# Default is no prefix.
|
||
path-prefix: ""
|
||
# Sort results by: filepath, line and column.
|
||
sort-results: true
|
||
|
||
linters-settings:
|
||
|
||
#complexity:
|
||
funlen:
|
||
# Проверяет длину функций
|
||
|
||
lines: 100 # Максимальное кол-во строк функции
|
||
statements: 60 # Максимальное кол-во утверждений
|
||
|
||
|
||
gocognit:
|
||
# Проверяет цикломатическую сложность
|
||
# Конфигурация https://golangci-lint.run/usage/linters/#gocyclo
|
||
# Репозиторий https://github.com/uudashr/gocognit
|
||
|
||
min-complexity: 20 # Максимально допустимая сложность
|
||
|
||
|
||
#bug
|
||
# nilerr - нет конфигурации
|
||
|
||
gosec:
|
||
# Проверяет отсутствие проблем безопасности
|
||
# Конфигурация https://golangci-lint.run/usage/linters/#gosec
|
||
# Репозиторий https://github.com/securego/gosec
|
||
|
||
exclude-generated: false
|
||
|
||
|
||
#code_style:
|
||
# goconst:
|
||
# # ищет переменные, которые можно вынести в константы.
|
||
# # Конфигурация https://golangci-lint.run/usage/linters/#goconst
|
||
# # Репозиторий https://github.com/jgautheron/goconst
|
||
#
|
||
# min-len: 2
|
||
# min-occurrences: 2
|
||
# ignore-tests: true
|
||
# match-constant: true
|
||
|
||
tagliatelle:
|
||
# Проверяет теги на использование нужного стиля
|
||
# Конфигурация https://golangci-lint.run/usage/linters/#tagliatelle
|
||
# Репозитория https://github.com/ldez/tagliatelle
|
||
|
||
case:
|
||
rules:
|
||
json: snake # требует snake_case для тегов json
|
||
|
||
varnamelen:
|
||
# Проверяет отсутствие слишком коротких имен переменных.
|
||
# Конфигурация https://golangci-lint.run/usage/linters/#varnamelen
|
||
# Репозиторий https://github.com/blizzy78/varnamelen
|
||
|
||
max-distance: 8 # минимальное кол-во строк скоупа при которой происходит проверка
|
||
min-name-length: 3 # минимальная длина названия переменной
|
||
|
||
check-receiver: false # не проверяет method receiver
|
||
check-return: true # проверяет название возвращаемого из фукнции значения
|
||
check-type-param: true # проверяет параметры типа
|
||
|
||
ignore-type-assert-ok: true # Пропускает _,ok переменную при val.(type)
|
||
ignore-map-index-ok: true # Пропускает _,ok переменную при map[intex]
|
||
ignore-chan-recv-ok: true # Пропускает _,ok переменную при <- channel
|
||
|
||
ignore-names: # Пропускает следующие имена
|
||
- c # для передачи (c *Core) в параметрах
|
||
- ch
|
||
- q
|
||
- id
|
||
- ip
|
||
- ok
|
||
- mq
|
||
- tx
|
||
- dn
|
||
- app
|
||
- cnt
|
||
- err
|
||
- job
|
||
- key
|
||
- log
|
||
- now
|
||
- raw
|
||
- row
|
||
- tcp
|
||
- trs
|
||
- ws
|
||
- db
|
||
- fs
|
||
- v # для работы с viper
|
||
- h
|
||
- r # для работы с роутером
|
||
- ms
|
||
- md # для работы с metadata
|
||
- wg # стандартное имя переменной waitGroup
|
||
|
||
ignore-decls: # игнорирует следующие определения
|
||
- t testing.T
|
||
- T any
|
||
- w http.ResponseWriter
|
||
- r *http.Request
|
||
- i int
|
||
- v interface{}
|
||
- wg sync.WaitGroup
|
||
- ctx context.Context
|
||
- cmd *cobra.Command
|
||
- img image.Image
|
||
- mux *runtime.ServeMux
|
||
|
||
# wastedassign - нет конфигурации
|
||
|
||
wsl:
|
||
# Проверяет наличие/отсутствие пустых строк между блоками.
|
||
# Подробная конфигурация https://github.com/bombsimon/wsl/blob/master/doc/configuration.md
|
||
|
||
strict-append: true # требует чтобы блоки с append были разделены по группам
|
||
allow-assign-and-call: true # разрешает не разделять присваивание и вызов метода
|
||
allow-assign-and-anything: false # требует чтобы после присваивания был пробел (исключение вызов метода)
|
||
allow-multiline-assign: true # разрешает не разделять группы присваиваний
|
||
allow-separated-leading-comment: true # позволяет иметь отдельные комментарии в начале блока
|
||
force-case-trailing-whitespace: 2 # требует чтобы после блока case, если в нем >= 2 строк, был пробел
|
||
allow-cuddle-declarations: false # требует чтобы блоки определения были сгруппированы скобками
|
||
allow-trailing-comment: true # разрешает комментарии в конце блока
|
||
force-err-cuddling: true # разрешает отделять проверку ошибок от вызова функции/метода
|
||
|
||
|
||
#other:
|
||
nolintlint:
|
||
# Проверяет использование директивы //nolint.
|
||
# Конфигурация https://golangci-lint.run/usage/linters/#nolintlint
|
||
# Репозиторий https://github.com/golangci/golangci-lint/tree/master/pkg/golinters/nolintlint
|
||
|
||
allow-unused: false # запрещает иметь неиспользуемые директивы
|
||
allow-leading-space: false # запрещает ставить пробел перед директивой (требование go code style)
|
||
require-specific: false # требует чтобы был указан линтер который выключается
|
||
require-explanation: true # требует объяснений использования диррективы
|
||
allow-no-explanation: [ ] # список исключений
|
||
|
||
# unused - нет конфигурации
|
||
|
||
#issues:
|
||
# new: false # проверяет только новые изменения
|
||
new-from-rev: HEAD # проверяет только код после этого комита - не работает
|
||
## fix: true # выключен т.к. отсутствуют линтеры с автофиксом
|
||
|
||
linters:
|
||
enable:
|
||
#complexity:
|
||
- gocognit # проверяет когнитивную сложность кода.
|
||
- funlen # проверяет длину функций
|
||
|
||
#bug:
|
||
- nilerr # проверяет возвращаемые ошибки https://github.com/gostaticanalysis/nilerr
|
||
- gosec # проверяет отсутствие проблем безопасности
|
||
|
||
#code_style:
|
||
# - goconst # ищет переменные, которые можно вынести в константы.
|
||
- tagliatelle # проверяет теги на использование нужного стиля
|
||
- varnamelen # проверяет отсутствие слишком коротких имен переменных
|
||
- wastedassign # проверяет отсутствие неиспользуемых присваиваний https://github.com/sanposhiho/wastedassign
|
||
- wsl # проверяет наличие/отсутствие пустых строк между блоками.
|
||
|
||
#other:
|
||
- nolintlint # проверяет использование директивы //nolint
|
||
- unused #проверяет неиспользуемые объекты https://github.com/dominikh/go-tools/tree/master/unused
|
||
|
||
# temp disabled
|
||
#- prealloc
|
||
|
||
fast: false
|
||
|
||
issues:
|
||
exclude-rules:
|
||
- path: 'internal\/manager\/infrastructure\/database\/(.+)\.go'
|
||
linters:
|
||
- funlen
|