version: "2"
linters:
  default: all
  disable:
    - cyclop
    - depguard
    - dogsled
    - dupl
    - err113
    - exhaustive
    - exhaustruct
    - fatcontext
    - funcorder
    - funlen
    - gocognit
    - goconst
    - gocyclo
    - godoclint
    - godot
    - lll
    - maintidx
    - mnd
    - noinlineerr
    - paralleltest
    - tagliatelle
    - testpackage
    - unqueryvet
    - varnamelen
    - wrapcheck
    - wsl
  settings:
    forbidigo:
      forbid:
        - pattern: ^(fmt\.Print(|f|ln)|print|println)$
        - pattern: ^syscall\.(.{1,7}|.{7}[^N]|.{9,})$
          msg: use golang.org/x/sys/windows instead of syscall
        - pattern: ^windows\.NewLazyDLL$
          msg: use NewLazySystemDLL instead NewLazyDLL
    goheader:
      values:
        const:
          COMPANY: The Prometheus Authors
      template: |-
        SPDX-License-Identifier: Apache-2.0

        Copyright {{ COMPANY }}
        Licensed under the Apache License, Version 2.0 (the "License");
        you may not use this file except in compliance with the License.
        You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
    gomoddirectives:
      toolchain-forbidden: true
    gosec:
      excludes:
        - G101
        - G115
    govet:
      enable-all: true
      disable:
        - fieldalignment
        - shadow
    revive:
      rules:
        - name: var-naming
          arguments:
            - [ ] # AllowList - do not remove as args for the rule are positional and won't work without lists first
            - [ ] # DenyList
            - - skip-package-name-checks: true
    sloglint:
      no-mixed-args: true
      kv-only: false
      attr-only: true
      no-global: all
      context: scope
      static-msg: false
      no-raw-keys: false
      key-naming-case: snake
      forbidden-keys:
        - time
        - level
        - msg
        - source
      args-on-sep-lines: true
    staticcheck:
      checks:
        - -ST1003
        - all
    tagliatelle:
      case:
        rules:
          json: camel
          yaml: snake
        use-field-name: true
  exclusions:
    generated: lax
    presets:
      - comments
      - common-false-positives
      - legacy
      - std-error-handling
    rules:
      - linters:
          - revive
        text: '`?\w+`? should be `?\w+`?'
      - linters:
          - revive
        text: don't use ALL_CAPS in Go names; use CamelCase
      - path: .+\.go$
        text: don't use underscores in Go names
      - path: .+\.go$
        text: don't use an underscore in package name
      - path: .+\.go$
        text: exported type .+ should have comment or be unexported
      - linters:
        - staticcheck
        text: "ST1003:"
    paths:
      - third_party$
      - builtin$
      - examples$
formatters:
  enable:
    - gci
    - gofmt
    - gofumpt
    - goimports
  settings:
    gci:
      sections:
        - prefix(github.com/prometheus-community/windows_exporter/internal/windowsservice)
        - standard
        - default
      custom-order: true
  exclusions:
    generated: lax
    paths:
      - third_party$
      - builtin$
      - examples$
