Skip to content

Commit

Permalink
docs: config-cli-lint-mode.md: Grammar tweaks (#2953)
Browse files Browse the repository at this point in the history
* docs: config-cli-lint-mode.md: Grammar tweaks

* Update config-cli-lint-mode.md per review comments

See #2953 (review)

* Update README.md

* Update README.md

Co-authored-by: Kurt von Laven <[email protected]>
  • Loading branch information
rasa and Kurt-von-Laven authored Sep 20, 2023
1 parent 1300aa0 commit 3ab9a1e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1233,22 +1233,22 @@ description: Cli lint mode can be list_of_files, project or files
-->
### CLI lint mode

Each linter has a lint mode by default, visible in its MegaLinter documentation ([example](https://megalinter.io/latest/descriptors/repository_trivy/#how-the-linting-is-performed)):
Each linter is pre-configured to use a default lint mode, which are visible in the MegaLinter documentation ([example](https://megalinter.io/latest/descriptors/repository_trivy/#how-the-linting-is-performed)). The possible values are:

- `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)
- `list_of_files`: The linter is called only once, and passed a list of all the files to be processed
- `project`: 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 it
- `file`: The linter is called once per file, which hurts performance

You can override the CLI_LINT_MODE by using configuration variable for each linter (see [linters documentation](https://megalinter.io/supported-linters/))
You can override the CLI_LINT_MODE by using a configuration variable for each linter (see [linters documentation](https://megalinter.io/supported-linters/)).

- 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`
- Linters that default to the `file` lint mode cannot be overridden to use the `list_of_files` lint mode
- Linters that default to the `project` lint mode cannot be overridden to use either the `list_of_files` or `file` lint modes.

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.
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:

- 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)
- Linters that are configured to use the `project` lint mode ignore variables like `FILTER_REGEX_INCLUDE` and `FILTER_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](https://megalinter.io/latest/descriptors/repository_secretlint/) linter ignore files listed in `~/.secretlintignore` by default, or it can be configured to instead ignore files listed in `~/.gitignore` by setting `REPOSITORY_SECRETLINT_ARGUMENTS` to `--secretlintignore .gitignore.`.

<!-- config-cli-lint-mode-section-end -->
<!-- configuration-section-end -->
Expand Down
19 changes: 9 additions & 10 deletions docs/config-cli-lint-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ description: Cli lint mode can be list_of_files, project or files

# CLI lint mode

Each linter has a lint mode by default, visible in its MegaLinter documentation ([example](https://megalinter.io/latest/descriptors/repository_trivy/#how-the-linting-is-performed)):
Each linter is pre-configured to use a default lint mode, which are visible in the MegaLinter documentation ([example](https://megalinter.io/latest/descriptors/repository_trivy/#how-the-linting-is-performed)). The possible values are:

- `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)
- `list_of_files`: The linter is called only once, and passed a list of all the files to be processed
- `project`: 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 it
- `file`: The linter is called once per file, which hurts performance

You can override the CLI_LINT_MODE by using configuration variable for each linter (see [linters documentation](https://megalinter.io/supported-linters/))
You can override the CLI_LINT_MODE by using a configuration variable for each linter (see [linters documentation](https://megalinter.io/supported-linters/)).

- 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`
- Linters that default to the `file` lint mode cannot be overridden to use the `list_of_files` lint mode
- Linters that default to the `project` lint mode cannot be overridden to use either the `list_of_files` or `file` lint modes.

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.
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:

- 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)

- Linters that are configured to use the `project` lint mode ignore variables like `FILTER_REGEX_INCLUDE` and `FILTER_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](https://megalinter.io/latest/descriptors/repository_secretlint/) linter ignore files listed in `~/.secretlintignore` by default, or it can be configured to instead ignore files listed in `~/.gitignore` by setting `REPOSITORY_SECRETLINT_ARGUMENTS` to `--secretlintignore .gitignore.`.

<!-- config-cli-lint-mode-section-end -->

0 comments on commit 3ab9a1e

Please sign in to comment.