synapsecns/sanguine

View on GitHub
.golangci.yml

Summary

Maintainability
Test Coverage
run:
  tests: true
  skip-dirs-use-default: false
  skip-dirs:
    - grpc/client/rest/*
    - bundle/*
    - generated/*
    - otelginmetrics/*
  timeout: 15m
  skip-files:
    - '.*\\.abigen\\.go$'
    - '.*\\.metadata\\.go$'
    - '.*\\.pb\\.go$'
    - '.*_gen.go$'

linters-settings:
  gofmt:
    simplify: true
  govet:
    # Don't report about shadowed variables
    check-shadowing: false
  misspell:
    locale: US
  gocritic:
    disabled-checks:
      - appendAssign
linters:
  enable-all: true
  disable:
    # Global variables are used in many places throughout the code base.
    - gochecknoglobals

    # Some lines are over 80 characters on purpose and we don't want to make them
    # even longer by marking them as 'nolint'.
    - lll

    # We don't care (enough) about misaligned structs to lint that.
    - maligned

    # We have long functions, especially in tests. Moving or renaming those would
    # trigger funlen problems that we may not want to solve at that time.
    - funlen

    # Disable for now as we haven't yet tuned the sensitivity to our codebase
    # yet.  Enabling by default for example, would also force new contributors to
    # potentially extensively refactor code, when they want to smaller change to
    # land.
    - gocyclo

    # Instances of table driven tests that don't pre-allocate shouldn't trigger
    # the linter.
    - prealloc

    # Init functions are used by loggers throughout the codebase.
    - gochecknoinits
    # this messes with formatting
    - goimports
    # TODO implement paralell tests
    - paralleltest
    # remove
    - wsl
    # skip for post set
    - exhaustruct
    - exhaustivestruct
    # if short
    - ifshort
    # we want to use todo
    - godox
    # skip new line return until autofix works for it
    - nlreturn
    # go 1.13 error
    - goerr113
    # disable gci
    - gci
    # disable gofumpt
    - gofumpt
    # allow magic numbers
    - gomnd
    # allow println
    - forbidigo
    # disabled (todo: enable)
    - interfacer
    # Allow nolint
    - nolintlint
    # we use external json tags
    - tagliatelle
    # var name len
    - varnamelen
    # allow replacements
    - gomoddirectives
    # no need to disallow returning interfaces
    - ireturn
    - nonamedreturns
    - contextcheck
    - nosnakecase
    - depguard
    # we use core/testsuite.Err() etc that don't get caught by this linter and result in false positives.
    - testifylint
    # we use metrics.EndSpan and metrics.EndSpanWithErr so this gets triggered falsely
    - spancheck
    # simply annoying
    - perfsprint
    # malfunctions on embedded structs
    - typecheck
    # magic numbers
    - mnd
    # constants
    - goconst
  fast: false

issues:
  # We use dot imports extensively in tests. Usually for testify assertions
  exclude-rules:
    - path: _test\.go
      linters:
        - revive
        - stylecheck
        - dupl
    # wrapping errors when exporting for testing is tedious
    - path: export_test\.go
      linters:
        - wrapcheck
      text: 'should not use dot imports'
    - path: contracts/
      linters:
        - revive
      text: 'and that stutters; consider calling this'
    - path: ethergo/example/*
      linters:
        - wrapcheck
    - path: testutil/*
      linters:
        - wrapcheck
    - path: ethergo/*
      linters:
        - staticcheck
      text: 'SA1019'
    - path: \.resolvers\.go
      linters:
        - cyclop
    - path: signoz/*
      linters:
        - gomnd
        - stylecheck
    - path: example/*
      linters:
        - revive
        - cyclop
        - forcetypeassert
        - staticcheck
        - wrapcheck
  exclude-use-default: false
  new-from-rev: 9fe0f033b73acf6b8240f0a832c4b4d21e68181b