Skip to content

Commit

Permalink
Merge pull request #1896 from oxsecurity/mega-linter-runner
Browse files Browse the repository at this point in the history
Document `-f` Argument to mega-linter-runner
  • Loading branch information
Kurt-von-Laven authored Sep 22, 2022
2 parents c7f7595 + 58a129c commit cdaf93b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion mega-linter-runner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The options are only related to mega-linter-runner. For MegaLinter options, plea
| Option | Description | Default |
|------------------------|--------------------------------------------------------------------------------------------------------------------|-------------------|
| `-p` <br/> `--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` <br/> `--flavor` | Set this parameter to use a [MegaLinter flavor](https://megalinter.github.io/flavors/) | `all` |
| `-d` <br/> `--image` | You can override the used docker image, including if it is on another docker registry | <!-- --> |
| `-e` <br/> `--env` | Environment variables for MegaLinter, following format **'ENV_VAR_NAME=VALUE'** <br/>Warning: Quotes are mandatory | <!-- --> |
| `--fix` | Automatically apply formatting and fixes in your files | <!-- --> |
Expand Down
7 changes: 4 additions & 3 deletions megalinter/MegaLinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,12 +563,13 @@ 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
if len(self.file_extensions) > 0:
# Filter files according to file_extensions, file_names_regex,
# filter_regex_include, and filter_regex_exclude
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))
)
Expand Down
4 changes: 2 additions & 2 deletions megalinter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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

Expand Down

0 comments on commit cdaf93b

Please sign in to comment.