Skip to content

mega-linter-runner -e ENABLE_LINTERS=YAML_PRETTIER,YAML_YAMLLINT only runs first linter, other linters are silently ignoredΒ #7500

@vroad

Description

@vroad

Describe the bug
mega-linter-runner (@9.4.0) runs only uses first linters, other linters are silently ignored.

npx mega-linter-runner -e ENABLE_LINTERS=YAML_PRETTIER,YAML_YAMLLINT gets translated to docker run command like this. (YAML_YAMLLINT passed as separate env var without value??)

Command: docker run --platform linux/amd64 --rm -v /var/run/docker.sock:/var/run/docker.sock:rw -v /home/nixos/Git/nixos-configuration-velox-wsl:/tmp/lint:rw -v /tmp/megalinter-1qbmLK/empty.env:/tmp/lint/.env:ro -e ENABLE_LINTERS=YAML_PRETTIER -e YAML_YAMLLINT ghcr.io/oxsecurity/megalinter:v9

On the other hand, mega-linter-runner works as expected if I set linters via .env instead.
example .env:

ENABLE_LINTERS=YAML_V8R,YAML_PRETTIER

npx mega-linter-ruuner translates this to a docker run command like this (which looks correct):

Command: docker run --platform linux/amd64 --rm -v /var/run/docker.sock:/var/run/docker.sock:rw -v /home/nixos/Git/nixos-configuration-velox-wsl:/tmp/lint:rw -v /tmp/megalinter-5mkuAV/empty.env:/tmp/lint/.env:ro -e ENABLE_LINTERS=YAML_V8R,YAML_PRETTIER -e ENABLE_LINTERS=YAML_PRETTIER -e ENABLE_LINTERS=YAML_YAMLLINT ghcr.io/oxsecurity/megalinter:v9

To Reproduce
Steps to reproduce the behavior:

  1. npx mega-linter-runner -e ENABLE_LINTERS=YAML_PRETTIER,YAML_YAMLLINT

Expected behavior
Runs all linters specified with -e ENABLE_LINTERS option

Additional context

Logs when linters specified via -e ENABLE_LINTERS command line option
❯ npx mega-linter-runner -e ENABLE_LINTERS=YAML_PRETTIER,YAML_YAMLLINT
Pulling docker image ghcr.io/oxsecurity/megalinter:v9 ... 
INFO: this operation can be long during the first use of mega-linter-runner
The next runs, it will be immediate (thanks to docker cache !)
v9: Pulling from oxsecurity/megalinter
Digest: sha256:ed944524cb36342a3693f5297ab92aef7188beff0a20a396fe9e90b4dcbbacfb
Status: Image is up to date for ghcr.io/oxsecurity/megalinter:v9
ghcr.io/oxsecurity/megalinter:v9
Command: docker run --platform linux/amd64 --rm -v /var/run/docker.sock:/var/run/docker.sock:rw -v /home/nixos/Git/nixos-configuration-velox-wsl:/tmp/lint:rw -v /tmp/megalinter-1qbmLK/empty.env:/tmp/lint/.env:ro -e ENABLE_LINTERS=YAML_PRETTIER -e YAML_YAMLLINT ghcr.io/oxsecurity/megalinter:v9
Skipped setting git safe.directory DEFAULT_WORKSPACE:  ...
Setting git safe.directory default: /github/workspace ...
Setting git safe.directory to /tmp/lint ...
[MegaLinter init] ONE-SHOT RUN
[config] /tmp/lint/.mega-linter.yml + Environment variables

    .:oool'                                  ,looo;                           
    .xNXNXl                                 .dXNNXo.                          
     lXXXX0c.                              'oKXXN0;                           
     .oKNXNX0kxdddddddoc,.    .;lodddddddxk0XXXX0c                            
      .:kKXXXXXXXXXXXXNXX0dllx0XXXXXXXXXXXXXXXKd,                             
        .,cdkOOOOOOOO0KXXXXXXXXXXK0OOOOOOOkxo:'                               
                      'ckKXNNNXkc'                                            
              ':::::;.  .c0XX0l.  .;::::;.                                    
              'xXXXXXx'   :kx:   ;OXXXXKd.                                    
               .dKNNXXO;   ..   :0XXXXKl.                                     
                .lKXXXX0:     .lKXXXX0:                                       
                  :0XXXXKl.  .dXXXXXk,                                        
                   ;kXXXXKd:cxXXXXXx'                                         
                    'xXNXXXXXXXXXKo.                                          
                     .oKXXXXNXXX0l.                                           
                      .lKNNXNNXO:                                             
                        ,looool'                                              

==========================================================
=============   MegaLinter, by OX.security   =============
=========  https://ox.security?ref=megalinter  ===========
==========================================================

----------------------------------------------------------------------------------------------------
------------------------------------ MegaLinter, by OX Security ------------------------------------
----------------------------------------------------------------------------------------------------
 - Image Creation Date: 2026-02-28T10:08:53Z
 - Image Revision: 8fbdead70d1409964ab3d5afa885e18ee85388bb
 - Image Version: v9.4.0
----------------------------------------------------------------------------------------------------
The MegaLinter documentation can be found at:
 - https://megalinter.io/9.4.0
----------------------------------------------------------------------------------------------------
MegaLinter initialization
MegaLinter will analyze workspace [/tmp/lint]

JSON_ESLINT_PLUGIN_JSONC has been disabled in MegaLinter for the following reason: Bug in eslint-plugin-jsonc: <https://github.com/ota-meshi/eslint-plugin-jsonc/issues/328>
LUA_SELENE has been disabled in MegaLinter for the following reason: https://github.com/Kampfkarren/selene/issues/662
MAKEFILE_CHECKMAKE has been disabled in MegaLinter for the following reason: Security issues: <https://github.com/checkmake/checkmake/issues/99>
MARKDOWN_REMARK_LINT has been disabled in MegaLinter for the following reason: Bug in remark-lint: <https://github.com/remarkjs/remark-lint/issues/322>
PUPPET_PUPPET_LINT has been disabled in MegaLinter for the following reason: <https://github.com/puppetlabs/puppet-lint/issues/251>
SALESFORCE_LIGHTNING_FLOW_SCANNER has been disabled in MegaLinter for the following reason: Repo archived -> <https://github.com/Lightning-Flow-Scanner>
Skipped linters: ACTION_ACTIONLINT, ANSIBLE_ANSIBLE_LINT, API_SPECTRAL, ARM_ARM_TTK, BASH_EXEC, BASH_SHELLCHECK, BASH_SHFMT, BICEP_BICEP_LINTER, CLOJURE_CLJSTYLE, CLOJURE_CLJ_KONDO, CLOUDFORMATION_CFN_LINT, COFFEE_COFFEELINT, COPYPASTE_JSCPD, CPP_CLANG_FORMAT, CPP_CPPCHECK, CPP_CPPLINT, CSHARP_CSHARPIER, CSHARP_DOTNET_FORMAT, CSHARP_ROSLYNATOR, CSS_STYLELINT, C_CLANG_FORMAT, C_CPPCHECK, C_CPPLINT, DART_DARTANALYZER, DOCKERFILE_HADOLINT, EDITORCONFIG_EDITORCONFIG_CHECKER, ENV_DOTENV_LINTER, GHERKIN_GHERKIN_LINT, GO_GOLANGCI_LINT, GO_REVIVE, GRAPHQL_GRAPHQL_SCHEMA_LINTER, GROOVY_NPM_GROOVY_LINT, HTML_DJLINT, HTML_HTMLHINT, JAVASCRIPT_ES, JAVASCRIPT_PRETTIER, JAVASCRIPT_STANDARD, JAVA_CHECKSTYLE, JAVA_PMD, JSON_ESLINT_PLUGIN_JSONC, JSON_JSONLINT, JSON_NPM_PACKAGE_JSON_LINT, JSON_PRETTIER, JSON_V8R, JSX_ESLINT, KOTLIN_DETEKT, KOTLIN_KTLINT, KUBERNETES_HELM, KUBERNETES_KUBECONFORM, KUBERNETES_KUBESCAPE, LATEX_CHKTEX, LUA_LUACHECK, LUA_SELENE, LUA_STYLUA, MAKEFILE_CHECKMAKE, MARKDOWN_MARKDOWNLINT, MARKDOWN_MARKDOWN_TABLE_FORMATTER, MARKDOWN_REMARK_LINT, MARKDOWN_RUMDL, PERL_PERLCRITIC, PHP_PHPCS, PHP_PHPCSFIXER, PHP_PHPLINT, PHP_PHPSTAN, PHP_PSALM, POWERSHELL_POWERSHELL, POWERSHELL_POWERSHELL_FORMATTER, PROTOBUF_PROTOLINT, PUPPET_PUPPET_LINT, PYTHON_BANDIT, PYTHON_BLACK, PYTHON_FLAKE8, PYTHON_ISORT, PYTHON_MYPY, PYTHON_NBQA_MYPY, PYTHON_PYLINT, PYTHON_PYRIGHT, PYTHON_RUFF, PYTHON_RUFF_FORMAT, RAKU_RAKU, REPOSITORY_CHECKOV, REPOSITORY_DEVSKIM, REPOSITORY_DUSTILOCK, REPOSITORY_GITLEAKS, REPOSITORY_GIT_DIFF, REPOSITORY_GRYPE, REPOSITORY_KICS, REPOSITORY_KINGFISHER, REPOSITORY_LS_LINT, REPOSITORY_SECRETLINT, REPOSITORY_SEMGREP, REPOSITORY_SYFT, REPOSITORY_TRIVY, REPOSITORY_TRIVY_SBOM, REPOSITORY_TRUFFLEHOG, ROBOTFRAMEWORK_ROBOCOP, RST_RSTCHECK, RST_RSTFMT, RST_RST_LINT, RUBY_RUBOCOP, RUST_CLIPPY, R_LINTR, SALESFORCE_CODE_ANALYZER_APEX, SALESFORCE_CODE_ANALYZER_AURA, SALESFORCE_CODE_ANALYZER_LWC, SALESFORCE_LIGHTNING_FLOW_SCANNER, SALESFORCE_SFDX_SCANNER_APEX, SALESFORCE_SFDX_SCANNER_AURA, SALESFORCE_SFDX_SCANNER_LWC, SCALA_SCALAFIX, SNAKEMAKE_LINT, SNAKEMAKE_SNAKEFMT, SPELL_CODESPELL, SPELL_CSPELL, SPELL_LYCHEE, SPELL_PROSELINT, SPELL_VALE, SQL_SQLFLUFF, SQL_TSQLLINT, SWIFT_SWIFTLINT, TEKTON_TEKTON_LINT, TERRAFORM_TERRAFORM_FMT, TERRAFORM_TERRAGRUNT, TERRAFORM_TERRASCAN, TERRAFORM_TFLINT, TSX_ESLINT, TYPESCRIPT_ES, TYPESCRIPT_PRETTIER, TYPESCRIPT_STANDARD, VBDOTNET_DOTNET_FORMAT, XML_XMLLINT, YAML_V8R, YAML_YAMLLINT
To receive reports as email, please set variable EMAIL_REPORTER_EMAIL
[ApiReporter] Not enabled as API_REPORTER is not defined to true

MegaLinter now collects the files to analyse
Listing all files in directory [/tmp/lint], then filter with:
- File extensions: .yaml, .yml
- Excluding .gitignored files [2]: .env, result
Kept [4] files on [16] found files

+----MATCHING LINTERS---+------------+----------------+------------+
| Descriptor | Linter   | Criteria   | Matching files | Format/Fix |
+------------+----------+------------+----------------+------------+
| YAML       | prettier | .yml|.yaml | 4              | yes        |
+------------+----------+------------+----------------+------------+

βœ… Linted [YAML] files with [prettier] successfully - (0.32s)
- Using [prettier v3.8.1] https://megalinter.io/9.4.0/descriptors/yaml_prettier
- MegaLinter key: [YAML_PRETTIER]
- Rules config: identified by [prettier]
- Number of files analyzed: [4]
- CWD: [/tmp/lint]
- Command: [prettier --write .github/workflows/claude.yml .github/workflows/mega-linter.yml .mega-linter.yml .pre-commit-config.yaml]

[Updated Sources Reporter] No source file has been formatted or fixed

+----SUMMARY-+----------+---------------+-------+-------+--------+----------+--------------+
| Descriptor | Linter   | Mode          | Files | Fixed | Errors | Warnings | Elapsed time |
+------------+----------+---------------+-------+-------+--------+----------+--------------+
| βœ… YAML    | prettier | list_of_files |     4 |     0 |      0 |        0 | 0.32s        |
+------------+----------+---------------+-------+-------+--------+----------+--------------+

You could have same capabilities but better runtime performances if you use a MegaLinter flavor:
- [formatters] oxsecurity/megalinter/flavors/formatters@v9 (19 linters) https://megalinter.io/9.4.0/flavors/formatters/
- [ci_light] oxsecurity/megalinter/flavors/ci_light@v9 (22 linters) https://megalinter.io/9.4.0/flavors/ci_light/
- [documentation] oxsecurity/megalinter/flavors/documentation@v9 (51 linters) https://megalinter.io/9.4.0/flavors/documentation/
Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining `FLAVOR_SUGGESTIONS: false`)
- Documentation: https://megalinter.io/9.4.0/custom-flavors/
- Command: `npx mega-linter-runner@9.4.0 --custom-flavor-setup --custom-flavor-linters YAML_PRETTIER`

βœ… Successfully linted all files without errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions