Open robinmordasiewicz opened 2 months ago
The .devcontainer file in MegaLinter is an inheritance from SuperLinter and i'm not sure it ever worked
It is possible to use MegaLinter as pre-commit ( @Kurt-von-Laven does it a lot ^^ ) , according to the documentation: https://megalinter.io/latest/mega-linter-runner/#pre-commit-hook
About devcontainer + pre-commit + env variable.... as i'm not a devcontainer user, I'm sorry but on my side I have no answer :(
I have written a bit of CMake code to run MegaLinter from within a devcontainer on code that is either mounted as a volume or bind mounted. The respective code can be found here: https://github.com/philips-software/amp-embedded-infra-lib/blob/main/cmake/emil_docker_tools.cmake. It should be fairly trivial to extract it to any type of language or scripting that you would like to use it in.
One detail: for the bind mount scenario you need to pass in an environment variable LOCAL_WORKSPACE_FOLDER in your devcontainer.json (I add this by default to all our devcontainers https://github.com/philips-software/amp-devcontainer).
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
}
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.
@rjaegers would you like to update the .devcontainer of MegaLinter to see if it works ? :)
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.
We are using devcontainers and want to run megalinter from a pre-commit, but devcontainer mounts the workspace repo to a folder in the devcontainer at location "/workspace/reponame" but megalinter is not aware of this mount inside the devcontainer. Is there a way to run megalinter from a pre-commit hook within the devcontainer and pass in an environment variable with the original filesystem mount location ?