diff --git a/common/.commonfiles.sha b/common/.commonfiles.sha index 6c6d747457..a99e94ce9c 100644 --- a/common/.commonfiles.sha +++ b/common/.commonfiles.sha @@ -1 +1 @@ -0d85ad5c87d38bd06ea5d08814df61e747e9135a +6943246e9954e4ba267186479cae64173ca0d102 diff --git a/common/config/.golangci.yml b/common/config/.golangci.yml index 59dd3321db..7bcf7cb379 100644 --- a/common/config/.golangci.yml +++ b/common/config/.golangci.yml @@ -5,30 +5,13 @@ # common-files repo, make the change there and check it in. Then come back to this repo and run # "make update-common". -service: - # When updating this, also update the version stored in docker/build-tools/Dockerfile in the istio/tools repo. - golangci-lint-version: 1.57.x # use the fixed version to not introduce new linters unexpectedly run: - # timeout for analysis, e.g. 30s, 5m, default is 1m - deadline: 20m + # Timeout for analysis, e.g. 30s, 5m. + # Default: 1m + timeout: 20m build-tags: - integ - integfuzz - # which dirs to skip: they won't be analyzed; - # can use regexp here: generated.*, regexp is applied on full path; - # default value is empty list, but next dirs are always skipped independently - # from this option's value: - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs: - - genfiles$ - - vendor$ - # 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. - skip-files: - - ".*\\.pb\\.go" - - ".*\\.gen\\.go" linters: disable-all: true enable: @@ -62,15 +45,13 @@ linters-settings: # default is false: such cases aren't reported by default. check-blank: false govet: - # report about shadowed variables - check-shadowing: false + disable: + # report about shadowed variables + - shadow goimports: # put imports beginning with prefix after 3rd-party packages; # it's a comma-separated list of prefixes local-prefixes: istio.io/ - maligned: - # print struct with more effective memory layout or not, false by default - suggest-new: true misspell: # Correct spellings using locale preferences for US or UK. # Default is to use a neutral variety of English. @@ -88,8 +69,6 @@ linters-settings: ignore-generated-header: false severity: "warning" confidence: 0.0 - error-code: 2 - warning-code: 1 rules: - name: blank-imports - name: context-keys-type @@ -146,16 +125,7 @@ linters-settings: # - name: flag-parameter # - name: unhandled-error # - name: if-return - unused: - # treat code as a program (not a library) and report unused exported identifiers; default is false. - # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: - # if it's called for subdir of a project it can't find funcs usages. All text editor integrations - # with golangci-lint call it on a directory with the changed file. - check-exported: false unparam: - # call graph construction algorithm (cha, rta). In general, use cha for libraries, - # and rta for programs with main packages. Default is cha. - algo: cha # Inspect exported functions, default is false. Set to true if no external program/library imports your code. # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: # if it's called for subdir of a project it can't find external interfaces. All text editor integrations @@ -167,6 +137,11 @@ linters-settings: - default # Contains all imports that could not be matched to another section type. - prefix(istio.io/) # Groups all imports with the specified Prefix. gocritic: + # Disable all checks. + # Default: false + disable-all: true + # Which checks should be enabled in addition to default checks. Since we don't want + # all of the default checks, we do the disable-all first. enabled-checks: - appendCombine - argOrder @@ -212,24 +187,6 @@ linters-settings: - unslice - valSwap - weakCond - # Unused - # - yodaStyleExpr - # - appendAssign - # - commentFormatting - # - emptyStringTest - # - exitAfterDefer - # - ifElseChain - # - hugeParam - # - importShadow - # - nestingReduce - # - paramTypeCombine - # - ptrToRefParam - # - rangeValCopy - # - singleCaseSwitch - # - sloppyReassign - # - unlabelStmt - # - unnamedResult - # - wrapperFunc depguard: rules: DenyGogoProtobuf: @@ -250,6 +207,24 @@ issues: # excluded by default patterns execute `golangci-lint run --help` exclude: - composite literal uses unkeyed fields + # Which dirs to exclude: issues from them won't be reported. + # Can use regexp here: `generated.*`, regexp is applied on full path, + # including the path prefix if one is set. + # Default dirs are skipped independently of this option's value (see exclude-dirs-use-default). + # "/" will be replaced by current OS file path separator to properly work on Windows. + # Default: [] + exclude-dirs: + - genfiles$ + - vendor$ + # Which files to exclude: they will be analyzed, but issues from them won't be reported. + # 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. + # Default: [] + exclude-files: + - ".*\\.pb\\.go" + - ".*\\.gen\\.go" exclude-rules: # Exclude some linters from running on test files. - path: _test\.go$|^tests/|^samples/ @@ -270,7 +245,9 @@ issues: # excluded by default patterns execute `golangci-lint run --help`. # Default value for this option is true. exclude-use-default: true - # Maximum issues count per one linter. Set to 0 to disable. Default is 50. - max-per-linter: 0 + # Maximum issues count per one linter. + # Set to 0 to disable. + # Default: 50 + max-issues-per-linter: 0 # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. max-same-issues: 0