Skip to content

Some _FILTER_REGEX_EXCLUDE variables stopped working in v7.0.x #2697

@ruzickap

Description

@ruzickap

Describe the bug

I'm using the following variables to exclude files/directory from being checked by different linters:

  • HTML_HTMLHINT_FILTER_REGEX_EXCLUDE
  • YAML_PRETTIER_FILTER_REGEX_EXCLUDE
  • YAML_V8R_FILTER_REGEX_EXCLUDE

https://github.com/ruzickap/ruzickap.github.io/blob/6ea83ad5c4d7619ac44f1957166566b487ad219a/.github/workflows/mega-linter.yml#L36-L53

These variables + values were working wine with megalinter 6.x.x (https://github.com/ruzickap/ruzickap.github.io/actions/runs/5105638022/jobs/9177339593), but Mega-Linter 7.0.x ignores the variables (https://github.com/ruzickap/ruzickap.github.io/actions/runs/5105642235/jobs/9177346850).

Details from executed megalinter 7.0.x:

Run oxsecurity/megalinter/flavors/documentation@v7.0.2

  env:
    BASH_SHFMT_ARGUMENTS: --indent 2 --space-redirects
    DISABLE_LINTERS: REPOSITORY_DEVSKIM,SPELL_CSPELL
    FORMATTERS_DISABLE_ERRORS: false
    GITHUB_COMMENT_REPORTER: false
    GITHUB_STATUS_REPORTER: true
    GITHUB_TOKEN: ***
    HTML_HTMLHINT_FILTER_REGEX_EXCLUDE: ^index.html
    JSON_PRETTIER_FILTER_REGEX_EXCLUDE: ^.markdown-link-check.json
    PRINT_ALPACA: false
    RUBY_RUBOCOP_FILTER_REGEX_EXCLUDE: ^_plugins
    SPELL_CSPELL_FILTER_REGEX_INCLUDE: (^README.md|^_posts/)
    VALIDATE_ALL_CODEBASE: true
    YAML_PRETTIER_FILTER_REGEX_EXCLUDE: (^_data/|^_config.yml)
    YAML_V8R_FILTER_REGEX_EXCLUDE: (^_data/|^_config.yml)
/usr/bin/docker run --name oxsecuritymegalinterdocumentationv702_57d585 --label ed866e --workdir /github/workspace --rm -e "BASH_SHFMT_ARGUMENTS" -e "DISABLE_LINTERS" -e "FORMATTERS_DISABLE_ERRORS" -e "GITHUB_COMMENT_REPORTER" -e "GITHUB_STATUS_REPORTER" -e "GITHUB_TOKEN" -e "HTML_HTMLHINT_FILTER_REGEX_EXCLUDE" -e "JSON_PRETTIER_FILTER_REGEX_EXCLUDE" -e "PRINT_ALPACA" -e "RUBY_RUBOCOP_FILTER_REGEX_EXCLUDE" -e "SPELL_CSPELL_FILTER_REGEX_INCLUDE" -e "VALIDATE_ALL_CODEBASE" -e "YAML_PRETTIER_FILTER_REGEX_EXCLUDE" -e "YAML_V8R_FILTER_REGEX_EXCLUDE" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/ruzickap.github.io/ruzickap.github.io":"/github/workspace" oxsecurity/megalinter-documentation:v7.0.2  "-v" "/var/run/docker.sock:/var/run/docker.sock:rw"
Skipped setting git safe.directory DEFAULT_WORKSPACE:  ...
Setting git safe.directory GITHUB_WORKSPACE: /github/workspace ...
Setting git safe.directory to /tmp/lint ...
[MegaLinter init] ONE-SHOT RUN
[config] Environment variables only (no config file found in /github/workspace)
----------------------------------------------------------------------------------------------------
------------------------------------ MegaLinter, by OX Security ------------------------------------
----------------------------------------------------------------------------------------------------
 - Image Creation Date: 2023-05-27T11:54:00Z
 - Image Revision: e99bc276c361c2f68c4976a5f86f7421c2c4d606
 - Image Version: v7.0.2
----------------------------------------------------------------------------------------------------
The MegaLinter documentation can be found at:
 - https://megalinter.io/7.0.2
----------------------------------------------------------------------------------------------------
MegaLinter initialization (expand for details)
MegaLinter now collects the files to analyse (expand for details)
MegaLinter flavor [documentation] doesn't contain linters REPOSITORY_DUSTILOCK,REPOSITORY_KICS,REPOSITORY_SYFT,RUBY_RUBOCOP.
As they're not available in this docker image, they will not be processed
To solve this problem, please either: 
- use default flavor oxsecurity/megalinter
- add ignored linters in DISABLE or DISABLE_LINTERS variables in your .mega-linter.yml config file located in your root directory
- ignore this message by setting config variable FLAVOR_SUGGESTIONS to false
Processing linters on [2] parallel cores…
✅ Linted [COPYPASTE] files with [jscpd] successfully - (1.01s) (expand for details)
✅ Linted [JSON] files with [v8r] successfully - (1.75s) (expand for details)
✅ Linted [REPOSITORY] files with [secretlint] successfully - (0.71s) (expand for details)
❌ Linted [YAML] files with [v8r]: Found 1 error(s) - (8.64s) (expand for details)
  - Using [v8r v2.0.0] https://megalinter.io/7.0.2/descriptors/yaml_v8r
  - MegaLinter key: [YAML_V8R]
  - Rules config: identified by [v8r]
  - Number of files analyzed: [34]
  --Error detail:
  ℹ No config file found
  ℹ Processing ./.checkov.yml
  ✖ Could not find a schema to validate ./.checkov.yml
...
...
...
  ℹ Processing ./_data/assets/cross_origin.yml
  ✖ Could not find a schema to validate ./_data/assets/cross_origin.yml
  
  ℹ Processing ./_data/assets/self_host.yml
  ✖ Could not find a schema to validate ./_data/assets/self_host.yml
  
  ℹ Processing ./_data/authors.yml
  ✖ Could not find a schema to validate ./_data/authors.yml
  
  ℹ Processing ./_data/contact.yml
  ✖ Could not find a schema to validate ./_data/contact.yml
  
  ℹ Processing ./_data/locales/ar.yml
  ✖ Could not find a schema to validate ./_data/locales/ar.yml
  
  ℹ Processing ./_data/locales/bg-BG.yml
  ✖ Could not find a schema to validate ./_data/locales/bg-BG.yml
  
  ℹ Processing ./_data/locales/cs-CZ.yml
  ✖ Could not find a schema to validate ./_data/locales/cs-CZ.yml
  
  ℹ Processing ./_data/locales/de-DE.yml
  ✖ Could not find a schema to validate ./_data/locales/de-DE.yml
  
  ℹ Processing ./_data/locales/el-GR.yml
  ✖ Could not find a schema to validate ./_data/locales/el-GR.yml
  
  ℹ Processing ./_data/locales/en.yml
  ✖ Could not find a schema to validate ./_data/locales/en.yml
...
...
...  
✅ Linted [REPOSITORY] files with [checkov] successfully - (8.79s) (expand for details)
✅ Linted [REPOSITORY] files with [trivy] successfully - (4.54s) (expand for details)
✅ Linted [ACTION] files with [actionlint] successfully - (0.09s) (expand for details)
✅ Linted [BASH] files with [bash-exec] successfully - (0.0s) (expand for details)
✅ Linted [BASH] files with [shellcheck] successfully - (0.5s) (expand for details)
✅ Linted [BASH] files with [shfmt] successfully - (0.0s) (expand for details)
✅ Linted [HTML] files with [djlint] successfully - (0.49s) (expand for details)
❌ Linted [HTML] files with [htmlhint]: Found 1 error(s) - (0.21s) (expand for details)
  - Using [htmlhint v1.1.4] https://megalinter.io/7.0.2/descriptors/html_htmlhint
  - MegaLinter key: [HTML_HTMLHINT]
  - Rules config: [.htmlhintrc]
  - Number of files analyzed: [1]
  --Error detail:
  
     Config loaded: /action/lib/.automation/.htmlhintrc
  
     /github/workspace/index.html
        L1 |---
            ^ Doctype must be declared first. (doctype-first)
  
  Scanned 1 files, found 1 errors in 1 files (18 ms)
  
✅ Linted [JSON] files with [jsonlint] successfully - (0.13s) (expand for details)
✅ Linted [JSON] files with [eslint-plugin-jsonc] successfully - (0.67s) (expand for details)
✅ Linted [JSON] files with [prettier] successfully - (0.38s) (expand for details)
✅ Linted [MARKDOWN] files with [markdownlint] successfully - (0.59s) (expand for details)
✅ Linted [MARKDOWN] files with [markdown-table-formatter] successfully - (0.23s) (expand for details)
✅ Linted [REPOSITORY] files with [gitleaks] successfully - (0.2s) (expand for details)
❌ Linted [YAML] files with [prettier]: Found 1 error(s) - (1.13s) (expand for details)
  - Using [prettier v2.8.8] https://megalinter.io/7.0.2/descriptors/yaml_prettier
  - MegaLinter key: [YAML_PRETTIER]
  - Rules config: identified by [prettier]
  - Number of files analyzed: [34]
  --Error detail:
  Checking formatting...
  [warn] _config.yml
  [warn] _data/contact.yml
  [warn] _data/locales/ar.yml
  [warn] _data/locales/cs-CZ.yml
  [warn] _data/locales/el-GR.yml
  [warn] _data/locales/en.yml
  [warn] _data/locales/es-ES.yml
  [warn] _data/locales/fi-FI.yml
  [warn] _data/locales/hu-HU.yml
  [warn] _data/locales/it-IT.yml
  [warn] _data/locales/ko-KR.yml
  [warn] _data/locales/vi-VN.yml
  [warn] _data/locales/zh-CN.yml
  [warn] Code style issues found in 13 files. Forgot to run Prettier?
  
✅ Linted [YAML] files with [yamllint] successfully - (0.51s) (expand for details)
✅ Linted [REPOSITORY] files with [git_diff] successfully - (0.01s) (expand for details)
✅ Linted [MARKDOWN] files with [markdown-link-check] successfully - (189.[94](https://github.com/ruzickap/ruzickap.github.io/actions/runs/5105642235/jobs/9177346850#step:5:97)s) (expand for details)

+----SUMMARY----+--------------------------+---------------+-------+-------+--------+--------------+
| Descriptor    | Linter                   | Mode          | Files | Fixed | Errors | Elapsed time |
+---------------+--------------------------+---------------+-------+-------+--------+--------------+
| ✅ ACTION     | actionlint               | list_of_files |     6 |       |      0 |        0.09s |
| ✅ BASH       | bash-exec                | file          |     2 |       |      0 |         0.0s |
| ✅ BASH       | shellcheck               | list_of_files |     2 |       |      0 |         0.5s |
| ✅ BASH       | shfmt                    | list_of_files |     2 |       |      0 |         0.0s |
| ✅ COPYPASTE  | jscpd                    | project       |   n/a |       |      0 |        1.01s |
| ✅ HTML       | djlint                   | list_of_files |     1 |       |      0 |        0.49s |
| ❌ HTML       | htmlhint                 | list_of_files |     1 |       |      1 |        0.21s |
| ✅ JSON       | eslint-plugin-jsonc      | list_of_files |     2 |       |      0 |        0.67s |
| ✅ JSON       | jsonlint                 | list_of_files |     1 |       |      0 |        0.13s |
| ✅ JSON       | prettier                 | list_of_files |     1 |       |      0 |        0.38s |
| ✅ JSON       | v8r                      | list_of_files |     1 |       |      0 |        1.75s |
| ✅ MARKDOWN   | markdownlint             | list_of_files |    13 |       |      0 |        0.59s |
| ✅ MARKDOWN   | markdown-link-check      | list_of_files |    13 |       |      0 |      [189](https://github.com/ruzickap/ruzickap.github.io/actions/runs/5105642235/jobs/9177346850#step:5:195).94s |
| ✅ MARKDOWN   | markdown-table-formatter | list_of_files |    13 |       |      0 |        0.23s |
| ✅ REPOSITORY | checkov                  | project       |   n/a |       |      0 |        8.79s |
| ✅ REPOSITORY | gitleaks                 | project       |   n/a |       |      0 |         0.2s |
| ✅ REPOSITORY | git_diff                 | project       |   n/a |       |      0 |        0.01s |
| ✅ REPOSITORY | secretlint               | project       |   n/a |       |      0 |        0.71s |
| ✅ REPOSITORY | trivy                    | project       |   n/a |       |      0 |        4.54s |
| ❌ YAML       | prettier                 | list_of_files |    34 |       |      1 |        1.13s |
| ❌ YAML       | v8r                      | list_of_files |    34 |       |      1 |        8.64s |
| ✅ YAML       | yamllint                 | list_of_files |    34 |       |      0 |        0.51s |
+---------------+--------------------------+---------------+-------+-------+--------+--------------+

[Updated Sources Reporter] No source file has been formatted or fixed
❌ Error(s) have been found during linting

To Reproduce
Steps to reproduce the behavior:

See the details above.

Expected behavior
The _FILTER_REGEX_EXCLUDE should work in the latest version like in mega-linter 6.x.x.

Thank you for looking at it...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions