Files
adk-go/.golangci.yml
c702d04f76 chore(lint): add misspell linter and perform US spelling sweep (#1465)
* chore(lint): add misspell linter and perform US spelling sweep

Rebased onto current main as a single commit, with the US spelling fixes extended to code that landed on main since, and folded one-time codespell cleanup for genuine typo coverage.

* chore(lint): use US spelling in applyLiveConnLimits comment

---------

Co-authored-by: wolo <wolo@google.com>
Co-authored-by: Sasha Shynkaruk <oleksandrsh@google.com>
Co-authored-by: Sasha <39381081+jjsasha63@users.noreply.github.com>
2026-10-09 12:05:27 +02:00

139 lines
4.7 KiB
YAML

version: "2"
formatters:
enable:
- goimports
- gofumpt
settings:
goimports:
local-prefixes:
- google.golang.org/adk/v2
gofumpt:
extra-rules: true
module-path: google.golang.org/adk/v2
linters:
enable:
- forbidigo
- goheader
- revive
- misspell
settings:
# Library code must not write diagnostics to a process-wide sink: an
# application embedding ADK cannot silence, route or filter them. See
# "Logging and error messages" in AGENTS.md for what to do instead.
forbidigo:
analyze-types: true
forbid:
- pattern: ^log\.((Print|Fatal|Panic)(f|ln)?|Output|Default|Writer|Set(Output|Flags|Prefix))$
pkg: ^log$
msg: library code must not use the standard log package's logger; see "Logging and error messages" in AGENTS.md
- pattern: ^slog\.((Debug|Info|Warn|Error)(Context)?|Log|LogAttrs|With|Default|SetDefault|SetLogLoggerLevel)$
pkg: ^log/slog$
msg: library code must not use the process-wide slog logger; see "Logging and error messages" in AGENTS.md
- pattern: ^os\.(Stdout|Stderr)$
pkg: ^os$
msg: library code must not write to stdout or stderr; see "Logging and error messages" in AGENTS.md
- pattern: ^fmt\.Print(f|ln)?$
pkg: ^fmt$
msg: library code must not write to stdout; see "Logging and error messages" in AGENTS.md
# An empty pkg matches the builtins and the defining name of a := or
# range variable, which have no package in TypesInfo.Uses. It does not
# match a func, var, parameter, result, field or method, or calls
# through any of these.
- pattern: ^print(ln)?$
pkg: ^$
msg: library code must not write to stderr; see "Logging and error messages" in AGENTS.md
misspell:
locale: US
# mode: restricted limits checks to comments only, preventing automatic
# rewriting of string literals in test prompts (e.g. favourite colour, summarise,
# recieve) that are bound to recorded HTTP test cassettes.
mode: restricted
revive:
rules:
- name: exported
arguments:
- disableStutteringCheck
- name: package-comments
goheader:
values:
const:
COMPANY: Google LLC
regexp:
YEAR: 20\d\d
template: |-
Copyright {{ YEAR }} {{ 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.
staticcheck:
checks:
# The default config:
- all
- -ST1000
- -ST1003
- -ST1016
- -ST1020
- -ST1021
- -ST1022
# Changes to the default config:
- -QF1001 # Exclude "Apply De Morgan's law"
- -QF1008 # Exclude "Omit embedded fields from selector expression"
- -SA1019 # Exclude to keep the old a2a compatibility, can remove for ADK v2
exclusions:
rules:
- path: 'internal/httprr/.*'
linters:
- goheader
- errcheck
- staticcheck
# Don't enforce doc comments on internal (non-importable) packages or on
# examples (demonstration code, not an importable API surface), while
# keeping any other revive rules active there.
- path: '(^|/)(internal|examples)/'
linters:
- revive
text: '^(exported|package-comments):'
# Binaries, examples and tests own their process, so writing to the
# terminal is theirs to decide. loggingplugin exists to print a
# human-readable trace to the terminal.
- path: '_test\.go$'
linters:
- forbidigo
- path: '(^|/)(cmd|examples)/'
linters:
- forbidigo
- path: '^plugin/loggingplugin/'
linters:
- forbidigo
- linters:
- misspell
text: '`CANCELLED` is a misspelling of `CANCELED`'
- path: 'internal/llminternal/contents_processor\.go'
linters:
- misspell
text: '`defualt` is a misspelling of `default`'
- path: 'model/openaimodel/internal/responses/response\.go'
linters:
- misspell
text: '`cancelled` is a misspelling of `canceled`'