github.com/ava-labs/avalanchego@v1.11.11/.golangci.yml (about)

     1  # https://golangci-lint.run/usage/configuration/
     2  run:
     3    timeout: 10m
     4  
     5    # If set we pass it to "go list -mod={option}". From "go help modules":
     6    # If invoked with -mod=readonly, the go command is disallowed from the implicit
     7    # automatic updating of go.mod described above. Instead, it fails when any changes
     8    # to go.mod are needed. This setting is most useful to check that go.mod does
     9    # not need updates, such as in a continuous integration and testing system.
    10    # If invoked with -mod=vendor, the go command assumes that the vendor
    11    # directory holds the correct copies of dependencies and ignores
    12    # the dependency descriptions in go.mod.
    13    #
    14    # Allowed values: readonly|vendor|mod
    15    # By default, it isn't set.
    16    modules-download-mode: readonly
    17  
    18    # Include non-test files tagged as test-only.
    19    # Context: https://github.com/ava-labs/avalanchego/pull/3173
    20    build-tags:
    21      - test
    22  
    23  output:
    24    # Make issues output unique by line.
    25    # Default: true
    26    uniq-by-line: false
    27  
    28  issues:
    29    # Maximum issues count per one linter.
    30    # Set to 0 to disable.
    31    # Default: 50
    32    max-issues-per-linter: 0
    33  
    34    # Maximum count of issues with the same text.
    35    # Set to 0 to disable.
    36    # Default: 3
    37    max-same-issues: 0
    38  
    39    # Enables skipping of directories:
    40    # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
    41    # Default: true
    42    exclude-dirs-use-default: false
    43  
    44  linters:
    45    disable-all: true
    46    enable:
    47      - asciicheck
    48      - bodyclose
    49      - depguard
    50      - dupword
    51      - errcheck
    52      - errorlint
    53      - exportloopref
    54      - forbidigo
    55      - gci
    56      - goconst
    57      - gocritic
    58      # - goerr113
    59      - gofmt
    60      - gofumpt
    61      # - gomnd
    62      - goprintffuncname
    63      - gosec
    64      - gosimple
    65      - govet
    66      - importas
    67      - ineffassign
    68      # - lll
    69      - misspell
    70      - nakedret
    71      - nilerr
    72      - noctx
    73      - nolintlint
    74      - perfsprint
    75      - prealloc
    76      - predeclared
    77      - revive
    78      - spancheck
    79      - staticcheck
    80      - stylecheck
    81      - tagalign
    82      - testifylint
    83      - typecheck
    84      - unconvert
    85      - unparam
    86      - unused
    87      - usestdlibvars
    88      - whitespace
    89  
    90  linters-settings:
    91    depguard:
    92      rules:
    93        packages:
    94          deny:
    95            - pkg: "container/list"
    96              desc: github.com/ava-labs/avalanchego/utils/linked should be used instead.
    97            - pkg: "github.com/golang/mock/gomock"
    98              desc: go.uber.org/mock/gomock should be used instead.
    99            - pkg: "github.com/stretchr/testify/assert"
   100              desc: github.com/stretchr/testify/require should be used instead.
   101            - pkg: "io/ioutil"
   102              desc: io/ioutil is deprecated. Use package io or os instead.
   103    errorlint:
   104      # Check for plain type assertions and type switches.
   105      asserts: false
   106      # Check for plain error comparisons.
   107      comparison: false
   108    forbidigo:
   109      # Forbid the following identifiers (list of regexp).
   110      forbid:
   111        - 'require\.Error$(# ErrorIs should be used instead)?'
   112        - 'require\.ErrorContains$(# ErrorIs should be used instead)?'
   113        - 'require\.EqualValues$(# Equal should be used instead)?'
   114        - 'require\.NotEqualValues$(# NotEqual should be used instead)?'
   115        - '^(t|b|tb|f)\.(Fatal|Fatalf|Error|Errorf)$(# the require library should be used instead)?'
   116      # Exclude godoc examples from forbidigo checks.
   117      exclude_godoc_examples: false
   118    gci:
   119      sections:
   120        - standard
   121        - default
   122        - blank
   123        - prefix(github.com/ava-labs/avalanchego)
   124        - alias
   125        - dot
   126      skip-generated: true
   127      custom-order: true
   128    gosec:
   129      excludes:
   130        - G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107
   131    importas:
   132      # Do not allow unaliased imports of aliased packages.
   133      no-unaliased: false
   134      # Do not allow non-required aliases.
   135      no-extra-aliases: false
   136      # List of aliases
   137      alias:
   138        - pkg: github.com/ava-labs/avalanchego/utils/math
   139          alias: safemath
   140        - pkg: github.com/ava-labs/avalanchego/utils/json
   141          alias: avajson
   142    revive:
   143      rules:
   144        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
   145        - name: bool-literal-in-expr
   146          disabled: false
   147        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return
   148        - name: early-return
   149          disabled: false
   150        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines
   151        - name: empty-lines
   152          disabled: false
   153        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format
   154        - name: string-format
   155          disabled: false
   156          arguments:
   157          - ["b.Logf[0]", "/.*%.*/", "no format directive, use b.Log instead"]
   158          - ["fmt.Errorf[0]", "/.*%.*/", "no format directive, use errors.New instead"]
   159          - ["fmt.Fprintf[1]", "/.*%.*/", "no format directive, use fmt.Fprint instead"]
   160          - ["fmt.Printf[0]", "/.*%.*/", "no format directive, use fmt.Print instead"]
   161          - ["fmt.Sprintf[0]", "/.*%.*/", "no format directive, use fmt.Sprint instead"]
   162          - ["log.Fatalf[0]", "/.*%.*/", "no format directive, use log.Fatal instead"]
   163          - ["log.Printf[0]", "/.*%.*/", "no format directive, use log.Print instead"]
   164          - ["t.Logf[0]", "/.*%.*/", "no format directive, use t.Log instead"]
   165        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
   166        - name: struct-tag
   167          disabled: false
   168        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming
   169        - name: unexported-naming
   170          disabled: false
   171        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error
   172        - name: unhandled-error
   173          # prefer the errcheck linter since it can be disabled directly with nolint directive
   174          # but revive's disable directive (e.g. //revive:disable:unhandled-error) is not
   175          # supported when run under golangci_lint
   176          disabled: true
   177        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
   178        - name: unused-parameter
   179          disabled: false
   180        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver
   181        - name: unused-receiver
   182          disabled: false
   183        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break
   184        - name: useless-break
   185          disabled: false
   186    spancheck:
   187      # https://github.com/jjti/go-spancheck#checks
   188      checks:
   189        - end
   190        # - record-error # check that `span.RecordError(err)` is called when an error is returned
   191        # - set-status   # check that `span.SetStatus(codes.Error, msg)` is called when an error is returned
   192    staticcheck:
   193      # https://staticcheck.io/docs/options#checks
   194      checks:
   195        - "all"
   196        - "-SA6002" # Storing non-pointer values in sync.Pool allocates memory
   197        - "-SA1019" # Using a deprecated function, variable, constant or field
   198    tagalign:
   199      align: true
   200      sort: true
   201      strict: true
   202      order:
   203        - serialize
   204    testifylint:
   205      # Enable all checkers (https://github.com/Antonboom/testifylint#checkers).
   206      # Default: false
   207      enable-all: true
   208      # Disable checkers by name
   209      # (in addition to default
   210      #   suite-thelper
   211      # ).
   212      disable:
   213        - go-require
   214        - float-compare