-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 2cceecb.
- Loading branch information
Showing
9 changed files
with
101 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
name: CI | ||
name: Check | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} | ||
branches: [ master ] | ||
|
||
jobs: | ||
unit-test: | ||
name: Unit Tests | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.21" | ||
- uses: actions/checkout@v3 | ||
- run: git config --global url.https://ci:$CI_GITHUB_TOKEN@github.com/.insteadOf https://github.com/ | ||
- run: make unit-tests | ||
go-version: 1.17 | ||
id: go | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: git config --global url.https://ci:$CI_GITHUB_TOKEN@github.com/.insteadOf https://github.com/ | ||
- uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.55.2 | ||
args: --timeout=5m | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get dependencies | ||
run: go get -v -t -d ./... | ||
|
||
- name: Unit Test | ||
run: make test | ||
|
||
- name: Lint | ||
run: make lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,215 +1,102 @@ | ||
service: | ||
golangci-lint-version: 1.38.x | ||
|
||
run: | ||
tests: false | ||
modules-download-mode: readonly | ||
|
||
linters-settings: | ||
cyclop: | ||
max-complexity: 20 | ||
# the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0) | ||
package-average: 0.0 | ||
skip-tests: false | ||
dogsled: | ||
# checks assignments with too many blank identifiers; default is 2 | ||
max-blank-identifiers: 2 | ||
dupl: | ||
threshold: 100 | ||
errcheck: | ||
check-type-assertions: false | ||
check-blank: false | ||
errorlint: | ||
errorf: false | ||
asserts: true | ||
comparison: true | ||
forbidigo: | ||
# Forbid the following identifiers (identifiers are written using regexp): | ||
forbid: | ||
- ^print.*$ | ||
- 'fmt\.Print.*' | ||
exclude_godoc_examples: true | ||
check-type-assertions: true | ||
check-blank: true | ||
funlen: | ||
lines: 60 | ||
statements: 60 | ||
gocognit: | ||
min-complexity: 35 | ||
goconst: | ||
min-len: 3 | ||
min-occurrences: 3 | ||
ignore-tests: true | ||
match-constant: true | ||
numbers: false | ||
min: 3 | ||
max: 3 | ||
ignore-calls: true | ||
gocritic: | ||
# Which checks should be disabled; can't be combined with 'enabled-checks' | ||
disabled-checks: | ||
- regexpMust | ||
gocyclo: | ||
min-complexity: 20 | ||
godot: | ||
# comments to be checked: `declarations`, `toplevel`, or `all` | ||
scope: all | ||
capital: false | ||
gofmt: | ||
# simplify code: gofmt with `-s` option | ||
simplify: true | ||
lines: 100 | ||
statements: 75 | ||
gofumpt: | ||
# Select the Go version to target | ||
lang-version: "1.21" | ||
extra-rules: false | ||
goimports: | ||
# put imports beginning with prefix after 3rd-party packages; | ||
# it's a comma-separated list of prefixes | ||
local-prefixes: github.com/trustwallet | ||
gomnd: | ||
settings: | ||
mnd: | ||
# the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. | ||
checks: | ||
- argument | ||
- case | ||
- condition | ||
- operation | ||
- return | ||
- assign | ||
ignored-numbers: 10,1000 | ||
gomoddirectives: | ||
replace-local: false | ||
gosec: | ||
# To select a subset of rules to run. | ||
# Available rules: https://github.com/securego/gosec#available-rules | ||
includes: | ||
- G401 | ||
- G306 | ||
- G101 | ||
gosimple: | ||
# Select the Go version to target | ||
go: "1.21" | ||
# https://staticcheck.io/docs/options#checks | ||
checks: [ "all" ] | ||
extra-rules: true | ||
govet: | ||
check-shadowing: true | ||
composites: false | ||
ifshort: | ||
# Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax. | ||
# Has higher priority than max-decl-chars. | ||
max-decl-lines: 1 | ||
# Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax. | ||
max-decl-chars: 30 | ||
importas: | ||
golibsGin: github:com/trustwallet/go-common/gin | ||
|
||
lll: | ||
# max line length | ||
line-length: 120 | ||
tab-width: 1 | ||
enable-all: true | ||
disable: | ||
- fieldalignment | ||
misspell: | ||
locale: US | ||
# ignore-words: | ||
revive: | ||
# see https://github.com/mgechev/revive#available-rules for details. | ||
ignore-generated-header: true | ||
severity: warning | ||
rules: | ||
- name: indent-error-flow | ||
severity: warning | ||
- name: time-naming | ||
severity: warn | ||
- name: errorf | ||
severity: warn | ||
- name: blank-imports | ||
sevetiry: warn | ||
# The error return parameter should be last | ||
- name: error-return | ||
severity: error | ||
# Redundant if when returning an error | ||
- name: if-return | ||
severity: warn | ||
# Warns when there are heading or trailing newlines in a block | ||
- name: empty-lines | ||
severity: error | ||
staticcheck: | ||
# Select the Go version to target | ||
go: "1.21" | ||
# https://staticcheck.io/docs/options#checks | ||
checks: [ "all" ] | ||
stylecheck: | ||
# Select the Go version to target | ||
go: "1.21" | ||
# https://staticcheck.io/docs/options#checks | ||
checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ] | ||
# https://staticcheck.io/docs/options#dot_import_whitelist | ||
dot-import-whitelist: | ||
- fmt | ||
# https://staticcheck.io/docs/options#initialisms | ||
initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS" ] | ||
# https://staticcheck.io/docs/options#http_status_code_whitelist | ||
http-status-code-whitelist: [ "200", "400", "404", "500" ] | ||
nolintlint: | ||
allow-unused: false | ||
allow-leading-space: true | ||
gci: | ||
local-prefixes: github.com/trustwallet | ||
unparam: | ||
check-exported: true | ||
unused: | ||
# Select the Go version to target | ||
go: "1.21" | ||
whitespace: | ||
multi-if: true # Enforces newlines (or comments) after every multi-line if statement | ||
multi-func: false # Enforces newlines (or comments) after every multi-line function signature | ||
wsl: | ||
# See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for | ||
# documentation of available settings | ||
allow-assign-and-anything: false | ||
allow-assign-and-call: true | ||
allow-cuddle-declarations: false | ||
allow-multiline-assign: true | ||
allow-separated-leading-comment: false | ||
allow-trailing-comment: false | ||
force-case-trailing-whitespace: 0 | ||
force-err-cuddling: false | ||
force-short-decl-cuddling: false | ||
strict-append: true | ||
|
||
check-exported: true | ||
errorlint: | ||
errorf: true | ||
gocyclo: | ||
min-complexity: 25 | ||
wrapcheck: | ||
ignorePackageGlobs: | ||
- github.com/trustwallet/* | ||
issues: | ||
new: false | ||
linters: | ||
disable-all: true | ||
enable: | ||
# - deadcode | ||
# - depguard | ||
- deadcode | ||
- errcheck | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
- unused | ||
- varcheck | ||
- asciicheck | ||
- bodyclose | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- durationcheck | ||
- errorlint | ||
- exhaustive | ||
- exportloopref | ||
- forcetypeassert | ||
- funlen | ||
- gci | ||
- gochecknoglobals | ||
- gochecknoinits | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
# - goerr113 | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
# - gomnd | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- ineffassign | ||
- importas | ||
- lll | ||
- makezero | ||
- misspell | ||
- nakedret | ||
- noctx | ||
- nestif | ||
- nilerr | ||
- nlreturn | ||
- nolintlint | ||
- paralleltest | ||
- prealloc | ||
- predeclared | ||
- revive | ||
- rowserrcheck | ||
- staticcheck | ||
# - structcheck | ||
- typecheck | ||
- sqlclosecheck | ||
- stylecheck | ||
- testpackage | ||
- thelper | ||
- tparallel | ||
- unconvert | ||
- unparam | ||
- unused | ||
# - varcheck | ||
- wastedassign | ||
- whitespace | ||
- asciicheck | ||
- gocognit | ||
- nestif | ||
- testpackage | ||
|
||
run: | ||
timeout: 2m | ||
issues-exit-code: 1 | ||
tests: false | ||
skip-dirs: | ||
- ide | ||
- local | ||
skip-dirs-use-default: true | ||
modules-download-mode: readonly | ||
allow-parallel-runners: false | ||
|
||
output: | ||
format: colored-line-number | ||
print-issued-lines: true | ||
print-linter-name: true | ||
uniq-by-line: true | ||
path-prefix: "" | ||
sort-results: true | ||
# - wrapcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.