mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
<!-- Describe what has changed in this PR --> **What changed?** 1. There's a lot of duplicated code in `temporal/fx.go` where we convert the dependencies in `ServiceProviderParamsCommon` into `fx.Option`s. I simply extracted a method for this so that the duplication is avoided. 2. I also increased the cyclomatic complexity threshold in our linter because it was complaining about the `ServerOptionsProvider` function, which is not complex in my opinion, just a little long. <!-- Tell your future self why have you made these changes --> **Why?** We probably had the duplication originally because `fx.Decorate` didn't exist, so the customization that the frontend service does would've been impossible. <!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? --> **How did you test it?** There's the existing `server_test.go`, which verifies that the `fx` graph builds and runs. <!-- Assuming the worst case, what can be broken when deploying this change to production? --> **Potential risks** <!-- Is this PR a hotfix candidate or require that a notification be sent to the broader community? (Yes/No) --> **Is hotfix candidate?**
115 lines
2.9 KiB
YAML
115 lines
2.9 KiB
YAML
# https://golangci-lint.run/usage/configuration/#config-file
|
|
linters:
|
|
disable-all: true
|
|
enable:
|
|
- goerr113
|
|
- errcheck
|
|
- goimports
|
|
# - paralleltest # missing the call to method parallel, but testify does not seem to work well with parallel test: https://github.com/stretchr/testify/issues/187
|
|
- revive # revive supersedes golint, which is now archived
|
|
- staticcheck
|
|
- vet
|
|
- forbidigo
|
|
run:
|
|
skip-dirs:
|
|
- ^api
|
|
- ^proto
|
|
- ^.git
|
|
linters-settings:
|
|
govet:
|
|
fieldalignment: 0
|
|
forbidigo:
|
|
forbid:
|
|
- p: ^time\.After$
|
|
msg: "time.After may leak resources. Use time.NewTimer instead."
|
|
revive:
|
|
severity: error
|
|
confidence: 0.8
|
|
enable-all-rules: true
|
|
rules:
|
|
# Disabled rules
|
|
- name: add-constant
|
|
disabled: true
|
|
- name: argument-limit
|
|
disabled: true
|
|
- name: bare-return
|
|
disabled: true
|
|
- name: banned-characters
|
|
disabled: true
|
|
- name: bool-literal-in-expr
|
|
disabled: true
|
|
- name: confusing-naming
|
|
disabled: true
|
|
- name: empty-lines
|
|
disabled: true
|
|
- name: error-naming
|
|
disabled: true
|
|
- name: errorf
|
|
disabled: true
|
|
- name: exported
|
|
disabled: true
|
|
- name: file-header
|
|
disabled: true
|
|
- name: function-length
|
|
disabled: true
|
|
- name: imports-blacklist
|
|
disabled: true
|
|
- name: increment-decrement
|
|
disabled: true
|
|
- name: line-length-limit
|
|
disabled: true
|
|
- name: max-public-structs
|
|
disabled: true
|
|
- name: nested-structs
|
|
disabled: true
|
|
- name: package-comments
|
|
disabled: true
|
|
- name: string-format
|
|
disabled: true
|
|
- name: unexported-naming
|
|
disabled: true
|
|
- name: unexported-return
|
|
disabled: true
|
|
- name: unused-parameter
|
|
disabled: true
|
|
- name: unused-receiver
|
|
disabled: true
|
|
- name: use-any
|
|
disabled: true
|
|
- name: var-naming
|
|
disabled: true
|
|
- name: empty-block
|
|
disabled: true
|
|
- name: flag-parameter
|
|
disabled: true
|
|
|
|
# Rule tuning
|
|
- name: cognitive-complexity
|
|
arguments:
|
|
- 25
|
|
- name: cyclomatic
|
|
arguments:
|
|
- 25
|
|
- name: function-result-limit
|
|
arguments:
|
|
- 5
|
|
- name: unhandled-error
|
|
arguments:
|
|
- "fmt.*"
|
|
- "bytes.Buffer.*"
|
|
- "strings.Builder.*"
|
|
issues:
|
|
# Exclude cyclomatic and cognitive complexity rules for functional tests in the `tests` root directory.
|
|
exclude-rules:
|
|
- path: ^tests\/.+\.go
|
|
text: "(cyclomatic|cognitive)"
|
|
linters:
|
|
- revive
|
|
- path: _test\.go|^common/persistence\/tests\/.+\.go # Ignore things like err = errors.New("test error") in tests
|
|
linters:
|
|
- goerr113
|
|
- path: ^tools\/.+\.go
|
|
linters:
|
|
- goerr113
|
|
- revive
|