Skip to content

CLI lint mode

Each linter has a lint mode by default, visible in its MegaLinter documentation (example):

  • list_of_files: All files are sent in single call to the linter
  • project: The linter is called from the root of the project, without specifying any file name
  • file: The linter is called once by file (so the performances may not be very good)

You can override the CLI_LINT_MODE by using configuration variable for each linter (see linters documentation)

  • Linters with file default lint mode can not be overridden to list_of_files
  • Linters with project default lint mode can not be overridden to list_of_files or file

Allowing file or list_of_files to be overridden to project is mostly for workarounds, for example with linters that have a problem to find their config file when the current folder isn't the repo root.

Special considerations:

  • As list of files isn't sent to the linter command, linters using project lint mode don't take in account some variables like FILTER_REGEX_INCLUDE and FILTER_REGEX_EXCLUDE. For those linters, you must check their documentation to define ignore configuration as it's awaited by the linter (for example with a .secretlintignore file for secretlint)