github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/.golangci.yml (about)

     1  # Copyright 2019 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  run:
     5    deadline: 8m
     6    skip-dirs:
     7      - pkg/kd
     8      - tools/syz-trace2syz
     9    # Autogenerated files take too much time and memory to load,
    10    # even if we skip them with skip-dirs.
    11    # So we define this tag and use it in the autogenerated files.
    12    build-tags:
    13      - codeanalysis
    14  
    15  output:
    16    print-linter-name: false
    17  
    18  linters:
    19    enable:
    20      - lll
    21      - vet
    22      - gofmt
    23      - revive
    24      - unconvert
    25      - goconst
    26      - unused
    27      - gosimple
    28      - misspell
    29      - gocyclo
    30      - vetshadow
    31      - megacheck
    32      - stylecheck
    33      - govet
    34      - whitespace
    35      - nestif
    36      - goprintffuncname
    37      - godot
    38      - gocognit
    39      - funlen
    40      - dupl
    41      - staticcheck
    42      - syz-linter
    43      - errorlint
    44    disable:
    45      - bodyclose
    46      - depguard
    47      - dogsled
    48      - gochecknoglobals
    49      - gochecknoinits
    50      - godox
    51      - goimports
    52      - gomnd
    53      - gomodguard
    54      - gosec
    55      - maligned
    56      - rowserrcheck
    57      - testpackage
    58      - typecheck
    59      - ineffassign
    60      # errcheck would be good to enable, but we need to fix existing warnings first.
    61      - errcheck
    62      - interfacer
    63      - unparam
    64      - nakedret
    65      - prealloc
    66      - scopelint
    67      - gocritic
    68      - wsl
    69  
    70  linters-settings:
    71    revive:
    72      rules:
    73      - name: package-comments
    74        disabled: true
    75    lll:
    76      line-length: 120
    77    gocyclo:
    78      # TODO: consider reducing this value.
    79      min-complexity: 24
    80    dupl:
    81      threshold: 60
    82    goconst:
    83      min-len: 3
    84      min-occurrences: 3
    85      ignore-tests: true # re-enable once goconst 1.7.0+ merged into golangci-lint
    86      ignore-strings: '.html'
    87    nestif:
    88      # TODO: consider reducing this value.
    89      min-complexity: 12
    90    godot:
    91      scope: toplevel
    92    gocognit:
    93      # TODO: consider reducing this value.
    94      min-complexity: 70
    95    funlen:
    96      # TODO: consider reducing these value.
    97      lines: 140
    98      statements: 80
    99    custom:
   100      syz-linter:
   101        path: bin/syz-linter.so
   102    errorlint:
   103      comparison: false # we want to use "err == iterator.Done"
   104  
   105  issues:
   106    exclude-use-default: false
   107    max-same-issues: 0
   108    exclude:
   109      - "exported .* should have comment"
   110      - "comment on .* should be of the form"
   111      - "at least one file in a package should have a package comment"
   112      # This check gives false positives related to the standard log.Fatalf
   113      # (which is strange, standard log package should be supported).#
   114      - "SA5011: possible nil pointer dereference"
   115    exclude-rules:
   116      - path: (pkg/csource/generated.go|pkg/build/linux_generated.go)
   117        linters:
   118          - lll
   119      - path: (sys/.*/init.*|sys/targets/common.go)
   120        text: "don't use ALL_CAPS in Go names|should not use ALL_CAPS in Go names"
   121      - path: (prog/.*)
   122        text: "methods on the same type should have the same receiver name"
   123      - path: (dashboard/app/.*_test\.go)
   124        linters:
   125          - dupl
   126      - path: (prog/.*_test\.go)
   127        linters:
   128          - goconst
   129      - path: (.*_test\.go)
   130        text: "Function '.*' is too long"