CLI lint mode
Each linter is pre-configured to use a default lint mode, which are visible in the MegaLinter documentation (example). The possible values are:
list_of_files: The linter is called only once, and passed a list of all the files to be processedproject: The linter is called only once, from the root folder of the repository, and it scans for the files to process, as no file names are provided itfile: The linter is called once per file, which hurts performance
You can override the CLI_LINT_MODE by using a configuration variable for each linter (see linters documentation).
- Linters that default to the
filelint mode cannot be overridden to use thelist_of_fileslint mode - Linters that default to the
projectlint mode cannot be overridden to use either thelist_of_filesorfilelint modes.
Allowing file or list_of_files to be overridden to project is mostly for workarounds. For example, some linters have a problem finding their config file when the current folder isn't the repository's root folder.
Special considerations:
- Linters that are configured to use the
projectlint mode ignore variables likeFILTER_REGEX_INCLUDEandFILTER_REGEX_EXCLUDE, as they are not passed a list of files to lint. For those linters, you must check their documentation to see if a linter can be configured to ignore specific files. For example, the Secretlint linter ignore files listed in~/.secretlintignoreby default, or it can be configured to instead ignore files listed in~/.gitignoreby settingREPOSITORY_SECRETLINT_ARGUMENTSto--secretlintignore .gitignore..