github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/scripts/staticcheck.sh (about)

     1  #!/usr/bin/env bash
     2  # Copyright (c) HashiCorp, Inc.
     3  # SPDX-License-Identifier: MPL-2.0
     4  
     5  
     6  echo "==> Checking that code complies with static analysis requirements..."
     7  # Skip legacy code which is frozen, and can be removed once we can refactor the
     8  # remote backends to no longer require it.
     9  skip="internal/legacy|backend/remote-state/"
    10  
    11  # Skip generated code for protobufs.
    12  skip=$skip"|internal/planproto|internal/tfplugin5|internal/tfplugin6"
    13  
    14  packages=$(go list ./... | egrep -v ${skip})
    15  
    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}