diff --git a/.drone.yml b/.drone.yml index aef50c7..ace45d5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,6 +14,7 @@ steps: image: golangci/golangci-lint:v1.50 pull: if-not-exists commands: + - cd src - golangci-lint run - name: "build and publish docker image" diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index f55b69b..0000000 --- a/.golangci.yml +++ /dev/null @@ -1,110 +0,0 @@ -timeout: 30m - -output: - format: tab - sort-results: true - -linters: - disable-all: true - enable: - # checks whether HTTP response body is closed successfully - - bodyclose - - # Tool for code clone detection - - dupl - - # Errcheck is a program for checking for unchecked errors in go programs. - # These unchecked errors can be critical bugs in some cases - - errcheck - - # Tool for detection of long functions - - funlen - - # Checks that no init functions are present in Go code - - gochecknoinits - - # Computes and checks the cyclomatic complexity of functions - - gocyclo - - # Gofmt checks whether code was gofmt-ed. - # By default this tool runs with -s option to check for code simplification - - gofmt - - # In addition to fixing imports, goimports also formats your code in the same style as gofmt. - - goimports - - # Detects when assignments to existing variables are not used - - ineffassign - - # Checks Go code for unused constants, variables, functions and types - - unused - - # Inspects source code for security problems - - gosec - -linters-settings: - gocyclo: - # Minimal code complexity to report. - # Default: 30 (but we recommend 10-20) - min-complexity: 40 - - funlen: - # Checks the number of lines in a function. - # If lower than 0, disable the check. - # Default: 60 - lines: 200 - # Checks the number of statements in a function. - # If lower than 0, disable the check. - # Default: 40 - statements: 200 - - gofmt: - # Simplify code: gofmt with `-s` option. - # Default: true - simplify: true - - goconst: - # Minimal length of string constant. - # Default: 3 - min-len: 3 - # Minimum occurrences of constant string count to trigger issue. - # Default: 3 - min-occurrences: 2 - # Ignore test files. - # Default: false - ignore-tests: true - # Look for existing constants matching the values. - # Default: true - match-constant: false - # Search also for duplicated numbers. - # Default: false - numbers: true - # Minimum value, only works with goconst.numbers - # Default: 3 - min: 2 - # Maximum value, only works with goconst.numbers - # Default: 3 - max: 2 - # Ignore when constant is not used as function argument. - # Default: true - ignore-calls: false - - goimports: - # Put imports beginning with prefix after 3rd-party packages. - # It's a comma-separated list of prefixes. - # Default: "" - local-prefixes: "" - -issues: - # Report all issues - max-issues-per-linter: 0 - max-same-issues: 0 - # Disable some - exclude-rules: - - path: main.go|app.go - linters: - - funlen - - path: _test\.go|mock|integration - linters: - - funlen - - goconst diff --git a/makefile b/makefile index 1cd62f4..4e1c77d 100644 --- a/makefile +++ b/makefile @@ -1,2 +1,5 @@ example: - go run main.go ./examples/in/ ./examples/out/ \ No newline at end of file + go run main.go ./examples/in/ ./examples/out/ + +lint: + docker run --rm -v "${PWD}/src:/src" golangci/golangci-lint:v1.50 /bin/sh -c "cd /src && golangci-lint run" \ No newline at end of file diff --git a/src/.golangci.yml b/src/.golangci.yml new file mode 100644 index 0000000..5c0b882 --- /dev/null +++ b/src/.golangci.yml @@ -0,0 +1,52 @@ +# See https://golangci-lint.run/usage/configuration/#config-file +output: + format: tab + sort-results: true + +run: + tests: false + allow-parallel-runners: true + +issues: + max-issues-per-linter: 0 + max-same-issues: 0 + fix: false + +linters-settings: + stylecheck: + checks: ["all", "-ST1003"] + +linters: + disable-all: true + enable: + - bodyclose + - unused + - depguard + - dogsled + - dupl + - errcheck + - exportloopref + - funlen + - gochecknoinits + - goconst + - gocritic + - gocyclo + - gofmt + - goimports + - goprintffuncname + - gosec + - gosimple + - govet + - ineffassign + - misspell + - nakedret + - noctx + - staticcheck + - structcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + - varcheck + - whitespace \ No newline at end of file