Skip to content

Mega-linter

Run mega-linter locally

npx

  • No installation needed
  • Starts docker run …, and fails with Podman with Error: statfs /var/run/docker.sock: permission denied
    • With Podman you'll need to run the container manually (see below)
$ npx mega-linter-runner --flavor ci_light \
  -e "'ENABLE=MARKDOWN,YAML'" -e 'SHOW_ELAPSED_TIME=true'
…
Command: docker run --platform linux/amd64 --rm \
  -v /var/run/docker.sock:/var/run/docker.sock:rw \
  -v $(pwd):/tmp/lint:rw \
  -e ENABLE=MARKDOWN,YAML \
  -e SHOW_ELAPSED_TIME=true \
  oxsecurity/megalinter-ci_light:v8

Global install

npm install mega-linter-runner -g

Run mega-linter with podman

Usage:

docker run --rm -v $(pwd):/tmp/lint:rw oxsecurity/megalinter:v7
systemctl --user start podman.socket
docker run --rm \
  -v /run/user/1000/podman/podman.sock:/var/run/docker.sock:rw \
  -v $(pwd):/tmp/lint:rw \
  -e ENABLE=YAML \
  oxsecurity/megalinter-ci_light:latest

Disable linters and checks

Use env vars, i.e.:

Disable linters:

export DISABLE_LINTERS="SPELL_CSPELL,SPELL_LYCHEE,PYTHON_PYRIGHT,PYTHON_MYPY,PYTHON_PYLINT,PYTHON_FLAKE8"

Disable checks:

tba..

Embedded linters

ci_light image

jscpd

{
  "threshold": 5,
  "ignore": ["charts/dark/crds/*.yaml", "**/templates/_helpers.tpl"]
}

Local usage:

npx jscpd --threshold 50 --exitCode 1 .

Issues: