megalinter icon indicating copy to clipboard operation
megalinter copied to clipboard

`EXTENDS` in `.mega-linter.yml`: Properties from extended file override properties in extending file

Open lars-reimann opened this issue 2 years ago • 7 comments

Describe the bug To simplify the configuration of MegaLinter across multiple repos I want to have one base config in my .github repo and then have a short configuration in each other repo that adds properties or overrides the ones from the base config. For example, in one repository I want to override the FILTER_REGEX_EXCLUDE property:

EXTENDS: https://raw.githubusercontent.com/lars-reimann/.github/main/.mega-linter.yml

# Config
FILTER_REGEX_EXCLUDE: (\.github/workflows/|someOtherFolder/)

However, this does not seem to work as expected: The FILTER_REGEX_EXCLUDE property from the extended config overrides the property defined here rather than the other way around. This means the base config can only contain properties that I know I'll never want to override.

To Reproduce Steps to reproduce the behavior:

  1. Create a base config.
  2. Create another config that extends the base config and overrides one of its properties.
  3. Observe the behavior of the linter.

Expected behavior The property in the extending file should have precedence.

Additional context At first glance this seems to cause this behavior: https://github.com/megalinter/megalinter/blob/100a4d937a48c79e0eb5de8325d4d2b22601d861/megalinter/config.py#L82

lars-reimann avatar Jun 07 '22 15:06 lars-reimann

This should indeed be the contrary: local config that overriddes default config from extended file ^^ I check

nvuillam avatar Jun 08 '22 13:06 nvuillam

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Jul 09 '22 01:07 github-actions[bot]

Should probably stay open.

lars-reimann avatar Jul 09 '22 07:07 lars-reimann

Agreed :) Sorry i'm very busy on preparing v6 these days ^^

nvuillam avatar Jul 09 '22 09:07 nvuillam

No worries, looking forward to v6.

lars-reimann avatar Jul 09 '22 09:07 lars-reimann

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Aug 09 '22 01:08 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Sep 17 '22 01:09 github-actions[bot]