terraform/scripts/staticcheck.sh
Nick Fagerlund af441abeda
Add staticcheck.conf to reduce unactionable noise in IDEs (#34036)
Since we already specify a list of staticcheck rules to ignore in the
scripts/staticcheck.sh wrapper script, this hoists those preferences up to the
top of the package tree, so they also affect the staticcheck integration in
editors like VSCode. This avoids unnecessary yellow-squiggles for capitalized
error messages, and makes integrated linting much more useful.
2023-10-12 11:01:12 -07:00

18 lines
666 B
Bash
Executable file

#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
echo "==> Checking that code complies with static analysis requirements..."
# Skip legacy code which is frozen, and can be removed once we can refactor the
# remote backends to no longer require it.
skip="internal/legacy|backend/remote-state/"
# Skip generated code for protobufs.
skip=$skip"|internal/planproto|internal/tfplugin5|internal/tfplugin6"
packages=$(go list ./... | egrep -v ${skip})
# Note that we globally disable some checks. The list is controlled by the
# top-level staticcheck.conf file in this repo.
go run honnef.co/go/tools/cmd/staticcheck ${packages}