blob: d6448db58a0b467412aec698d2ade1df674d4172 [file]
# Copyright 2025 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json
version: "2"
# https://golangci-lint.run/usage/configuration/#linters-configuration
linters:
enable:
- copyloopvar
- errorlint
- gomodguard_v2
- intrange
- misspell
- modernize
- unconvert
- unparam
- usetesting
disable:
# There are also many unchecked errors.
- errcheck
settings:
# TODO(gregorynisbet): Use default config here.
errorlint:
# Moving %v or %s to %w is a breaking API change.
errorf: false
modernize:
disable:
# prefer proto.String etc over new expr for a while
- newexpr
staticcheck:
checks:
- all
- "-ST1000"
- "-ST1003"
- "-ST1016"
- "-ST1020"
- "-ST1021"
- "-ST1022"
# Aboves are default set of checks in golangci-lint.
usetesting:
context-background: true
context-todo: true
exclusions:
# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
# The old `exclude-use-default: false` setting implied manual control, reflected here.
rules:
- linters:
- unparam
path: "^(\
kajiya/capabilities/service.go|\
runmc/machine_type.go|\
runmc/main.go|\
)$"
- path: "^(\
siso/execute/cmd.go|\
siso/subcmd/recall/recall.go|\
)$"
text: "(OutputFiles|Platform) is deprecated: Marked as deprecated in build/bazel/remote/execution/v2/remote_execution.proto"
paths:
# Ignore files under third_party dir.
- ^third_party/.*\.go$
# https://golangci-lint.run/usage/configuration/#issues-configuration
issues:
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
# Make issues output unique by line.
# Default: true
uniq-by-line: false
formatters:
enable:
- gci
settings:
# https://golangci-lint.run/usage/formatters/#gci
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
# Standard section: captures all standard packages.
- standard
# Default section: contains all imports that could not be matched to another section type.
- default
# Custom section: groups all imports with the specified Prefix.
- prefix(go.chromium.org)
# Custom section: groups all imports with the specified Prefix (local modules).
- localmodule
# Blank section: contains all blank imports.
- blank
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
custom-order: true