Skip to content

Commit 5302dea

Browse files
committed
ci(pre-commit): register tests/e2e module in gosec hook; fix sp.tf EOF
Address the Major CR finding on #1376 and the red pre-commit CI job. - scripts/gosec-hook.sh: add tests/e2e to MODULE_DIRS. It is a standalone Go module (tests/e2e/go.mod) but the hook only knew providers/* and pkg, so staged files there were scanned from the repo root as ./tests/e2e, breaking module/package resolution. Now mirrors the per-module loop in ci.yml (root, pkg, providers/{aws,azure,gcp}, tests/e2e). - terraform/environments/azure/ci-cd-permissions/sp.tf: strip the extra trailing blank line so the file ends with a single newline. The end-of-file-fixer pre-commit hook runs --all-files in CI and flagged this pre-existing whitespace on every PR. The pre-commit gocyclo failure is pre-existing repo-wide debt (four AWS service-client functions at complexity 11, below golangci's threshold of 15 but above the hook's -over 10). Not touched by this PR; tracked in the follow-up issue.
1 parent 09ef6ab commit 5302dea

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎scripts/gosec-hook.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ GOSEC_BIN="${HOME}/.cache/pre-commit-gosec/v${GOSEC_VERSION}/gosec"
3838
GOSEC_EXCLUDE="G101,G104,G115,G117,G118,G122,G204,G301,G304,G402,G505,G702,G703,G705,G706"
3939

4040
# Module roots in longest-prefix order (so "providers/azure" is checked before
41-
# a hypothetical "providers" root).
42-
MODULE_DIRS="providers/azure providers/aws providers/gcp pkg"
41+
# a hypothetical "providers" root). Must mirror the per-module loop in
42+
# .github/workflows/ci.yml (root, pkg, providers/{aws,azure,gcp}, tests/e2e)
43+
# so a changed file under tests/e2e is scanned from within its own module.
44+
MODULE_DIRS="tests/e2e providers/azure providers/aws providers/gcp pkg"
4345

4446
# ---- helpers ----------------------------------------------------------------
4547

‎terraform/environments/azure/ci-cd-permissions/sp.tf‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,3 @@ resource "azuread_application_federated_identity_credential" "github_pr" {
4747
issuer = "https://token.actions.githubusercontent.com"
4848
subject = "repo:${var.github_repo}:pull_request"
4949
}
50-

0 commit comments

Comments
 (0)