2020-12-02 12:02:33 -05:00
|
|
|
#!/usr/bin/env bash
|
2023-05-02 11:33:06 -04:00
|
|
|
# Copyright IBM Corp. 2014, 2026
|
2023-08-10 18:43:27 -04:00
|
|
|
# SPDX-License-Identifier: BUSL-1.1
|
2023-05-02 11:33:06 -04:00
|
|
|
|
2020-12-02 12:02:33 -05:00
|
|
|
|
|
|
|
|
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})
|
|
|
|
|
|
2023-10-12 14:01:12 -04:00
|
|
|
# Note that we globally disable some checks. The list is controlled by the
|
|
|
|
|
# top-level staticcheck.conf file in this repo.
|
2025-02-12 08:27:24 -05:00
|
|
|
go tool honnef.co/go/tools/cmd/staticcheck ${packages}
|