Skip to content

Commit af441ab

Browse files
authored
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.
1 parent 24ac539 commit af441ab

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Diff for: scripts/staticcheck.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ skip=$skip"|internal/planproto|internal/tfplugin5|internal/tfplugin6"
1313

1414
packages=$(go list ./... | egrep -v ${skip})
1515

16-
# We are skipping style-related checks, since terraform intentionally breaks
17-
# some of these. The goal here is to find issues that reduce code clarity, or
18-
# may result in bugs. We also disable fucntion deprecation checks (SA1019)
19-
# because our policy is to update deprecated calls locally while making other
20-
# nearby changes, rather than to make cross-cutting changes to update them all.
21-
go run honnef.co/go/tools/cmd/staticcheck -checks 'all,-SA1019,-ST*' ${packages}
16+
# Note that we globally disable some checks. The list is controlled by the
17+
# top-level staticcheck.conf file in this repo.
18+
go run honnef.co/go/tools/cmd/staticcheck ${packages}

Diff for: staticcheck.conf

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Our goal in using staticcheck is to find issues that reduce code clarity, or
2+
# may result in bugs. We are skipping style-related checks, since terraform
3+
# intentionally breaks some of these. We also disable function deprecation
4+
# checks (SA1019) because our policy is to update deprecated calls locally while
5+
# making other nearby changes, rather than to make cross-cutting changes to
6+
# update them all.
7+
checks = ["all", "-SA1019", "-ST*"]

0 commit comments

Comments
 (0)