github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/.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  version: "2"
     5  
     6  run:
     7    timeout: 8m
     8    # Autogenerated files take too much time and memory to load,
     9    # even if we skip them with issues.exclude-dirs.
    10    # So we define this tag and use it in the autogenerated files.
    11    build-tags:
    12      - codeanalysis
    13  
    14  output:
    15    formats:
    16      text:
    17        print-issued-lines: false
    18  
    19  formatters:
    20    enable:
    21      - gofmt
    22    disable:
    23     - goimports
    24  
    25  linters:
    26    enable:
    27      # keep-sorted start
    28      - dupl
    29      - errorlint
    30      - funlen
    31      - gocognit
    32      - goconst
    33      - gocyclo
    34      - godot
    35      - goprintffuncname
    36      - govet
    37      - lll
    38      - misspell
    39      - nestif
    40      - recvcheck
    41      - revive
    42      - staticcheck
    43      - syz-linter
    44      - unconvert
    45      - unused
    46      - whitespace
    47      # keep-sorted end
    48    disable:
    49      # keep-sorted start
    50      - bodyclose
    51      - depguard
    52      - dogsled
    53      # errcheck would be good to enable, but we need to fix existing warnings first.
    54      - errcheck
    55      - gochecknoglobals
    56      - gochecknoinits
    57      - gocritic
    58      - godox
    59      - gomodguard
    60      - gosec
    61      - ineffassign
    62      - nakedret
    63      - prealloc
    64      - rowserrcheck
    65      - testpackage
    66      - unparam
    67      - wsl
    68      # keep-sorted end
    69    settings:
    70      # keep-sorted start block=yes
    71      custom:
    72        syz-linter:
    73          path: bin/syz-linter.so
    74      dupl:
    75        threshold: 60
    76      errorlint:
    77        comparison: false # we want to use "err == iterator.Done"
    78      funlen:
    79        # TODO: consider reducing these value.
    80        lines: 140
    81        statements: 80
    82      gocognit:
    83        # TODO: consider reducing this value.
    84        min-complexity: 70
    85      goconst:
    86        min-len: 3
    87        min-occurrences: 3
    88        ignore-string-values: ['\.html|^true$']
    89      gocyclo:
    90        # TODO: consider reducing this value.
    91        min-complexity: 24
    92      godot:
    93        scope: toplevel
    94        exclude: ["keep-sorted"]
    95      lll:
    96        line-length: 120
    97      nestif:
    98        # TODO: consider reducing this value.
    99        min-complexity: 12
   100      revive:
   101        rules:
   102        - name: package-comments
   103          disabled: true
   104        - name: argument-limit
   105          arguments: [ 7 ]
   106      staticcheck:
   107        checks:
   108        - all
   109        - -ST1000 # at least one file in a package should have a package comment
   110        - -ST1020 # comment on exported function Foo should be of the form "Foo ..."
   111        - -ST1021 # comment on exported type Foo should be of the form "Foo ..." (with optional leading article)
   112        - -ST1022 # comment on exported const Foo should be of the form "Foo ..."
   113        - -QF1008 # could remove embedded field "..." from selector
   114      # keep-sorted end
   115    exclusions:
   116      warn-unused: true # Log a warning if an exclusion path is unused.
   117      rules:
   118        - path: (sys/.*/init.*|sys/targets/common.go)
   119          text: "don't use ALL_CAPS in Go names|should not use ALL_CAPS in Go names"
   120        - path: (prog/.*)
   121          text: "methods on the same type should have the same receiver name"
   122        - path: (dashboard/app/.*_test\.go)
   123          linters:
   124          - dupl
   125        - path: (prog/.*_test\.go)
   126          linters:
   127          - goconst
   128        - path: (.*_test\.go)
   129          text: "Function '.*' is too long"
   130        - path: tools/syz-trace2syz
   131          linters:
   132          - unused
   133          - syz-linter
   134          - godot
   135        - path: sys/register.go
   136          linters:
   137            - whitespace # TODO: fix the code generation
   138        - path: (.*_test.go)
   139          linters:
   140            - goconst
   141  
   142  issues:
   143    max-same-issues: 0