Command option for each file #423
jcook-uptycs
started this conversation in
Ideas
Replies: 2 comments
-
Hey! What tools do you use? 🤔 Looks like a good option but it's quite hard to implement. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I find it with a lot of tools. But here are a few. pre-commit:
commands:
trivy-dockerfile:
glob: "**/*{Dockerfile}*"
env:
TRIVY_EXIT_CODE: 1
run: |
for FILE in {files}
do
trivy filesystem \
--license-full \
--security-checks=vuln,secret,license \
"${FILE}"
done
depcheck:
glob: "*{package.json,package-lock.json,.js}"
env:
report: ./tmp/reports/depcheck.txt
run: |
set -eo pipefail
mkdir -p "$(dirname "${report}")"
echo > "${report}"
for FILE in {files}
do
echo "scanning file '${FILE}'..." | tee -a "${report}"
npx --yes depcheck \
"$(dirname "${FILE}")" | tee -a "${report}" || EXIT=1
done
exit ${EXIT} A lot of this might be because we have a bit of a mono repo setup. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have found myself writing a bunch of for each loops in the
run
option.There are a few lint and testing tools that only take a single file, or directory as input. These then require I write a for each to take the {files} or {staged_files} and run the tool on each file.
While this works, it makes for a very long config file. Also it affects the parallel option that lefthook has. Each of these for each is then no longer parallel with each other.
Beta Was this translation helpful? Give feedback.
All reactions