github.com/kubevela/workflow@v0.6.0/.golangci.yml (about)

     1  run:
     2    timeout: 10m
     3  
     4    skip-files:
     5      - "zz_generated\\..+\\.go$"
     6      - ".*_test.go$"
     7  
     8    skip-dirs:
     9      - "hack"
    10      - "e2e"
    11  
    12  output:
    13    # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
    14    format: colored-line-number
    15  
    16  linters-settings:
    17    errcheck:
    18      # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
    19      # default is false: such cases aren't reported by default.
    20      check-type-assertions: false
    21  
    22      # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
    23      # default is false: such cases aren't reported by default.
    24      check-blank: false
    25  
    26      # [deprecated] comma-separated list of pairs of the form pkg:regex
    27      # the regex is used to ignore names within pkg. (default "fmt:.*").
    28      # see https://github.com/kisielk/errcheck#the-deprecated-method for details
    29      ignore: fmt:.*,io/ioutil:^Read.*
    30  
    31    exhaustive:
    32      # indicates that switch statements are to be considered exhaustive if a
    33      # 'default' case is present, even if all enum members aren't listed in the
    34      # switch
    35      default-signifies-exhaustive: true
    36  
    37    govet:
    38      # report about shadowed variables
    39      check-shadowing: false
    40  
    41    gofmt:
    42      # simplify code: gofmt with `-s` option, true by default
    43      simplify: true
    44  
    45    goimports:
    46      # put imports beginning with prefix after 3rd-party packages;
    47      # it's a comma-separated list of prefixes
    48      local-prefixes: github.com/oam-dev/kubevela
    49  
    50    gocyclo:
    51      # minimal code complexity to report, 30 by default (but we recommend 10-20)
    52      min-complexity: 30
    53  
    54    maligned:
    55      # print struct with more effective memory layout or not, false by default
    56      suggest-new: true
    57  
    58    dupl:
    59      # tokens count to trigger issue, 150 by default
    60      threshold: 100
    61  
    62    goconst:
    63      # minimal length of string constant, 3 by default
    64      min-len: 3
    65      # minimal occurrences count to trigger, 3 by default
    66      min-occurrences: 5
    67  
    68    lll:
    69      # tab width in spaces. Default to 1.
    70      tab-width: 1
    71  
    72    unused:
    73      # treat code as a program (not a library) and report unused exported identifiers; default is false.
    74      # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
    75      # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
    76      # with golangci-lint call it on a directory with the changed file.
    77      check-exported: false
    78  
    79    unparam:
    80      # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
    81      # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
    82      # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
    83      # with golangci-lint call it on a directory with the changed file.
    84      check-exported: false
    85  
    86    nakedret:
    87      # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
    88      max-func-lines: 30
    89  
    90    gocritic:
    91      # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
    92      # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
    93      enabled-tags:
    94        - performance
    95  
    96      settings: # settings passed to gocritic
    97        captLocal: # must be valid enabled check name
    98          paramsOnly: true
    99        rangeValCopy:
   100          sizeThreshold: 32
   101  
   102    makezero:
   103      # Allow only slices initialized with a length of zero. Default is false.
   104      always: false
   105  
   106  linters:
   107    enable:
   108      - megacheck
   109      - govet
   110      - gocyclo
   111      - gocritic
   112      - goconst
   113      - goimports
   114      - gofmt  # We enable this as well as goimports for its simplify mode.
   115      - revive
   116      - unconvert
   117      - misspell
   118      - nakedret
   119    fast: false
   120  
   121  
   122  issues:
   123    # Excluding configuration per-path and per-linter
   124    exclude-rules:
   125      # Exclude some linters from running on tests files.
   126      - path: _test(ing)?\.go
   127        linters:
   128          - gocyclo
   129          - errcheck
   130          - dupl
   131          - gosec
   132          - exportloopref
   133          - unparam
   134  
   135      # Ease some gocritic warnings on test files.
   136      - path: _test\.go
   137        text: "(unnamedResult|exitAfterDefer)"
   138        linters:
   139          - gocritic
   140  
   141      # These are performance optimisations rather than style issues per se.
   142      # They warn when function arguments or range values copy a lot of memory
   143      # rather than using a pointer.
   144      - text: "(hugeParam|rangeValCopy):"
   145        linters:
   146          - gocritic
   147  
   148      # This "TestMain should call os.Exit to set exit code" warning is not clever
   149      # enough to notice that we call a helper method that calls os.Exit.
   150      - text: "SA3000:"
   151        linters:
   152          - staticcheck
   153      
   154      - text: "package-comments: should have a package comment"
   155        linters:
   156          - revive
   157  
   158      - text: "k8s.io/api/core/v1"
   159        linters:
   160          - goimports
   161  
   162      # This is a "potential hardcoded credentials" warning. It's triggered by
   163      # any variable with 'secret' in the same, and thus hits a lot of false
   164      # positives in Kubernetes land where a Secret is an object type.
   165      - text: "G101:"
   166        linters:
   167          - gosec
   168          - gas
   169  
   170      # This is an 'errors unhandled' warning that duplicates errcheck.
   171      - text: "G104:"
   172        linters:
   173          - gosec
   174          - gas
   175  
   176      # The Azure AddToUserAgent method appends to the existing user agent string.
   177      # It returns an error if you pass it an empty string lettinga you know the
   178      # user agent did not change, making it more of a warning.
   179      - text: \.AddToUserAgent
   180        linters:
   181          - errcheck
   182  
   183      - text: "don't use an underscore"
   184        linters:
   185          - revive
   186  
   187    # Independently from option `exclude` we use default exclude patterns,
   188    # it can be disabled by this option. To list all
   189    # excluded by default patterns execute `golangci-lint run --help`.
   190    # Default value for this option is true.
   191    exclude-use-default: false
   192  
   193    # Show only new issues: if there are unstaged changes or untracked files,
   194    # only those changes are analyzed, else only changes in HEAD~ are analyzed.
   195    # It's a super-useful option for integration of golangci-lint into existing
   196    # large codebase. It's not practical to fix all existing issues at the moment
   197    # of integration: much better don't allow issues in new code.
   198    # Default is false.
   199    new: false
   200  
   201    # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
   202    max-per-linter: 0
   203  
   204    # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
   205    max-same-issues: 0