Open vorburger opened 8 months ago
Thank you for reporting this issue. As a workaround, I would suggest passing the --container-name
as an argument (an args
array) to the pre-commit hook. Pre-commit has the unfortunate restriction of requiring hooks to be pinned to a release, making self-testing surprisingly cumbersome. I am open to suggestions from the community about how to achieve this or PRs.
Couldn't we use a default container name if not sent in options ?
Yes, that is a very easy fix.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
If you think this issue should stay open, please remove the O: stale 🤖
label or comment on the issue.
Any idea if this bug is still to solve ?
@nvuillam I don't think that the pre-commit hooks as defined can be customised due to the use of args
. e.g. if I have this pre-commit
config:
- repo: https://github.com/oxsecurity/megalinter
rev: v7.10.0 # Git tag specifying the hook, not mega-linter-runner, version
hooks:
- id: megalinter-incremental # Faster, less thorough
stages:
- commit
- id: megalinter-full # Slower, more thorough
stages:
- push
args:
- --containername
- terraform
The args
will just be passed to npx --
like npx -- containername terraform
overriding the defaults on this repo.
Let me know if I'm not doing this correctly!
For now I've just defined a local job:
- repo: local
hooks:
- id: megalinter-terraform
name: megalinter-terraform
language: system
require_serial: true
entry: npx --
args:
- mega-linter-runner
- --containername
- megalinter-terraform
- --remove-container
# - --fix
# - --env
# - "'APPLY_FIXES=all'"
- --env
- "'CLEAR_REPORT_FOLDER=true'"
- --env
- "'LOG_LEVEL=warning'"
Our pre-commit expert is @Kurt-von-Laven ... do you have any idea Kurt ? :)
Args you don't want to be overwritten need to be dumped into the entry
Describe the bug It appears https://megalinter.io/latest/mega-linter-runner/#pre-commit-hook is broken?
To Reproduce
Add https://megalinter.io/latest/mega-linter-runner/#pre-commit-hook to https://github.com/www-learn-study/saraswati.learn.study/blob/main/.pre-commit-config.yaml,
which uses
pre-commit==3.5.0
(see https://github.com/www-learn-study/saraswati.learn.study/blob/main/requirements.txt)run https://github.com/www-learn-study/saraswati.learn.study/blob/main/bin/pre-commit.sh
Expected behavior It works.
Actual behavior
Additional context
Perhaps there is a way for the project to detect this earlier by somehow self testing this?