From e5ed96ec3a94901e30059e64a0cc9313169c738d Mon Sep 17 00:00:00 2001 From: Tyler Jang Date: Mon, 23 Oct 2023 11:49:23 -0700 Subject: [PATCH 1/2] terrascan --- linters/terrascan/plugin.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linters/terrascan/plugin.yaml b/linters/terrascan/plugin.yaml index 2165d8ed3..708a28d58 100644 --- a/linters/terrascan/plugin.yaml +++ b/linters/terrascan/plugin.yaml @@ -51,5 +51,5 @@ lint: run: terrascan version environment: - name: PATH - list: ["${linter}"] + list: ["${linter}", "${env.PATH}"] direct_configs: [terrascan_config.toml] From 416a890497418f844fd9ac34f87152943b0fd564 Mon Sep 17 00:00:00 2001 From: Tyler Jang Date: Mon, 23 Oct 2023 15:07:10 -0700 Subject: [PATCH 2/2] try adding a git remote --- linters/terrascan/plugin.yaml | 2 +- linters/terrascan/terrascan.test.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/linters/terrascan/plugin.yaml b/linters/terrascan/plugin.yaml index 708a28d58..2165d8ed3 100644 --- a/linters/terrascan/plugin.yaml +++ b/linters/terrascan/plugin.yaml @@ -51,5 +51,5 @@ lint: run: terrascan version environment: - name: PATH - list: ["${linter}", "${env.PATH}"] + list: ["${linter}"] direct_configs: [terrascan_config.toml] diff --git a/linters/terrascan/terrascan.test.ts b/linters/terrascan/terrascan.test.ts index 45e5e6f15..c623a840e 100644 --- a/linters/terrascan/terrascan.test.ts +++ b/linters/terrascan/terrascan.test.ts @@ -1,3 +1,11 @@ import { linterCheckTest } from "tests"; +import { TrunkLintDriver } from "tests/driver"; -linterCheckTest({ linterName: "terrascan" }); +// NOTE(Tyler): Terrascan will sometimes fail due to a git error: +// "failed to fetch references from git repo. error: 'some refs were not updated'" +// Add a remote in order to avoid this error. +const preCheck = async (driver: TrunkLintDriver) => { + await driver.gitDriver?.addRemote("origin", driver.getSandbox()); +}; + +linterCheckTest({ linterName: "terrascan", preCheck });