#
# Copyright 2021 The Sigstore Authors.
#
# 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.

version: "2"
run:
  issues-exit-code: 1
linters:
  enable:
    - errcheck
    - gocritic
    - gosec
    - misspell
    - revive
    - unused
  settings:
    gosec:
      excludes:
        - G115  # integer overflow conversion int -> uint32
        - G602  # slice index out of range
  exclusions:
    generated: lax
    presets:
      - comments
      - common-false-positives
      - legacy
      - std-error-handling
    rules:
      - linters:
          - errcheck
          - gosec
        path: _test\.go
      - linters:
          - staticcheck
        # the following section is due to the legacy API being deprecated
        path: pkg/server/legacy_server.go
        text: SA1019
      - linters:
          - staticcheck
        path: pkg/ca/tinkca/signer.go
        text: SA1019
    paths:
      - third_party$
      - builtin$
      - examples$
issues:
  max-issues-per-linter: 0
  max-same-issues: 0
  uniq-by-line: false
formatters:
  enable:
    - gofmt
    - goimports
  exclusions:
    generated: lax
    paths:
      - third_party$
      - builtin$
      - examples$
