From a8b07ee957c2ff5dbae5ba6a4ecb2507833c431f Mon Sep 17 00:00:00 2001 From: Kurt von Laven Date: Mon, 18 Oct 2021 16:41:23 -0700 Subject: [PATCH 1/4] Make minor corrections to a comment. --- megalinter/MegaLinter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/megalinter/MegaLinter.py b/megalinter/MegaLinter.py index 2019a70b7db..5dee801de02 100644 --- a/megalinter/MegaLinter.py +++ b/megalinter/MegaLinter.py @@ -563,7 +563,8 @@ def collect_files(self): logging.debug( "All found files before filtering:" + utils.format_bullet_list(all_files) ) - # Filter files according to fileExtensions, fileNames , filterRegexInclude and filterRegexExclude + # Filter files according to file_extensions, file_names_regex, + # filter_regex_include, and filter_regex_exclude if len(self.file_extensions) > 0: logging.info( "- File extensions: " + ", ".join(sorted(self.file_extensions)) From 65f16e8853ae35cc785a5e36f09d1e43a8bd808e Mon Sep 17 00:00:00 2001 From: Kurt von Laven Date: Mon, 18 Oct 2021 16:42:23 -0700 Subject: [PATCH 2/4] Simplify tests for empty collections. --- megalinter/MegaLinter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/megalinter/MegaLinter.py b/megalinter/MegaLinter.py index 5dee801de02..fe0e51e5a7e 100644 --- a/megalinter/MegaLinter.py +++ b/megalinter/MegaLinter.py @@ -565,11 +565,11 @@ def collect_files(self): ) # Filter files according to file_extensions, file_names_regex, # filter_regex_include, and filter_regex_exclude - if len(self.file_extensions) > 0: + if self.file_extensions: logging.info( "- File extensions: " + ", ".join(sorted(self.file_extensions)) ) - if len(self.file_names_regex) > 0: + if self.file_names_regex: logging.info( "- File names (regex): " + ", ".join(sorted(self.file_names_regex)) ) From 3c1de5ad0f228b4caa338bb26da5175bd9124173 Mon Sep 17 00:00:00 2001 From: Kurt von Laven Date: Mon, 18 Oct 2021 16:42:37 -0700 Subject: [PATCH 3/4] Prefer frozenset to set when no mutations made. --- megalinter/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/megalinter/utils.py b/megalinter/utils.py index ed820760626..e67e5c873c1 100644 --- a/megalinter/utils.py +++ b/megalinter/utils.py @@ -74,7 +74,7 @@ def filter_files( lint_all_other_linters_files: bool = False, prefix: Optional[str] = None, ) -> Sequence[str]: - file_extensions = set(file_extensions) + file_extensions = frozenset(file_extensions) filter_regex_include_object = ( re.compile(filter_regex_include) if filter_regex_include else None ) @@ -92,7 +92,7 @@ def filter_files( # if each file is check against every ignored_files (it can contain all the files), it's a O(n²) filtering # to reduce the execution time and complexity ignored_files is split ignored_patterns = list(filter(lambda x: "*" in x, ignored_files or [])) - ignored_fileset = set(ignored_files or []) + ignored_fileset = frozenset(ignored_files or []) # Filter all files to keep only the ones matching with the current linter From 58a129c01e92d28d42324860daff45f915392d78 Mon Sep 17 00:00:00 2001 From: Kurt von Laven Date: Mon, 18 Oct 2021 16:40:04 -0700 Subject: [PATCH 4/4] Document -f argument to mega-linter-runner (#1895) -f is the short form of --flavor. --- CHANGELOG.md | 1 + mega-linter-runner/README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c31dc82548..3ec4df17c89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-linter.yml file, or with `oxsecurity/megalinter:beta` docker image +- Document the `-f` argument to mega-linter-runner ([#1895](https://github.com/oxsecurity/megalinter/issues/1895)) - Fix a typo in documentation of bash-exec linter ([#1892](https://github.com/oxsecurity/megalinter/pull/1892)) - Add quotes to arm-ttk linter command ([#1879](https://github.com/oxsecurity/megalinter/issues/1879)) diff --git a/mega-linter-runner/README.md b/mega-linter-runner/README.md index cdc6000e427..bbc378d2a6b 100644 --- a/mega-linter-runner/README.md +++ b/mega-linter-runner/README.md @@ -97,7 +97,7 @@ The options are only related to mega-linter-runner. For MegaLinter options, plea | Option | Description | Default | |------------------------|--------------------------------------------------------------------------------------------------------------------|-------------------| | `-p`
`--path` | Directory containing the files to lint | current directory | -| `--flavor` | Set this parameter to use a [MegaLinter flavor](https://megalinter.github.io/flavors/) | `all` | +| `-f`
`--flavor` | Set this parameter to use a [MegaLinter flavor](https://megalinter.github.io/flavors/) | `all` | | `-d`
`--image` | You can override the used docker image, including if it is on another docker registry | | | `-e`
`--env` | Environment variables for MegaLinter, following format **'ENV_VAR_NAME=VALUE'**
Warning: Quotes are mandatory | | | `--fix` | Automatically apply formatting and fixes in your files | |