You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling the mega-linter-runner from the CLI and passing a list of files as positional arguments, these files get joined by the mega-linter-runner/lib/runner.js at https://github.com/oxsecurity/megalinter/blob/main/mega-linter-runner/lib/runner.js#L154. This results in the following being passed to the docker run command: -e MEGALINTER_FILES_TO_LINT=".mega-linter.yml,.pre-commit-config.yaml,app.py".
Expected behaviour
The expectation is that megalinter will run its checks against the list of files passed into it.
Actual behaviour
Megalinter only runs it's checks against .pre-commit-config.yaml (in this example), and throws the following warning messages:
[File listing] Input file /tmp/lint/".mega-linter.yml not found
[File listing] Input file /tmp/lint/app.py" not found
I discovered this when trying to run megalint via a pre-commit hook with the pass_filenames argument set at true. Pre-commit passes the list of stages files as a list of positional arguments to the command being called.
One can easily reproduce this issue by running something similar to npx -- mega-linter-runner --remove-container --flavor python --fix file1.py file2.py file3.py
The text was updated successfully, but these errors were encountered:
This is a very helpful and greatly appreciated duplicate of #1942 that adds a lot of clarity. I'm closing this simply for the sake of bookkeeping, but will continue the discussion on the original issue when I get a chance.
Describe the bug
When calling the
mega-linter-runner
from the CLI and passing a list of files as positional arguments, these files get joined by themega-linter-runner/lib/runner.js
at https://github.com/oxsecurity/megalinter/blob/main/mega-linter-runner/lib/runner.js#L154. This results in the following being passed to thedocker run
command:-e MEGALINTER_FILES_TO_LINT=".mega-linter.yml,.pre-commit-config.yaml,app.py"
.Expected behaviour
The expectation is that megalinter will run its checks against the list of files passed into it.
Actual behaviour
Megalinter only runs it's checks against
.pre-commit-config.yaml
(in this example), and throws the following warning messages:Notice the first warning is due to the first filename being pre-pended with a
"
, and the second is due to the filename appended with a"
. This is cause by the creating of the env var at https://github.com/oxsecurity/megalinter/blob/main/mega-linter-runner/lib/runner.js#L154 and/or the unpacking of the list at https://github.com/oxsecurity/megalinter/blob/main/megalinter/config.py#L136.To Reproduce
I discovered this when trying to run megalint via a pre-commit hook with the
pass_filenames
argument set attrue
. Pre-commit passes the list of stages files as a list of positional arguments to the command being called.One can easily reproduce this issue by running something similar to
npx -- mega-linter-runner --remove-container --flavor python --fix file1.py file2.py file3.py
The text was updated successfully, but these errors were encountered: