-
-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support mixing remote and local configs in EXTENDS
#2533
base: main
Are you sure you want to change the base?
Conversation
🦙 MegaLinter status:
|
Descriptor | Linter | Files | Fixed | Errors | Elapsed time |
---|---|---|---|---|---|
✅ BASH | bash-exec | 6 | 0 | 0.01s | |
✅ BASH | shellcheck | 6 | 0 | 0.19s | |
✅ BASH | shfmt | 6 | 0 | 0 | 0.43s |
✅ COPYPASTE | jscpd | yes | no | 3.24s | |
✅ DOCKERFILE | hadolint | 116 | 0 | 19.29s | |
✅ JSON | eslint-plugin-jsonc | 21 | 0 | 0 | 2.42s |
✅ JSON | jsonlint | 19 | 0 | 0.28s | |
✅ JSON | v8r | 21 | 0 | 14.87s | |
markdownlint | 312 | 0 | 230 | 7.71s | |
✅ MARKDOWN | markdown-link-check | 312 | 0 | 5.57s | |
✅ MARKDOWN | markdown-table-formatter | 312 | 0 | 0 | 20.32s |
✅ OPENAPI | spectral | 1 | 0 | 1.7s | |
bandit | 185 | 54 | 2.99s | ||
✅ PYTHON | black | 185 | 0 | 0 | 5.32s |
✅ PYTHON | flake8 | 185 | 0 | 4.51s | |
✅ PYTHON | isort | 185 | 0 | 0 | 0.87s |
✅ PYTHON | mypy | 185 | 0 | 8.48s | |
✅ PYTHON | pylint | 185 | 0 | 13.41s | |
pyright | 185 | 252 | 20.05s | ||
✅ PYTHON | ruff | 185 | 0 | 0 | 0.45s |
✅ REPOSITORY | checkov | yes | no | 38.61s | |
✅ REPOSITORY | git_diff | yes | no | 0.39s | |
✅ REPOSITORY | secretlint | yes | no | 15.17s | |
✅ REPOSITORY | trivy | yes | no | 35.84s | |
✅ SPELL | cspell | 753 | 0 | 27.78s | |
✅ SPELL | misspell | 572 | 0 | 0 | 0.95s |
✅ XML | xmllint | 3 | 0 | 0 | 0.42s |
✅ YAML | prettier | 81 | 0 | 0 | 3.18s |
✅ YAML | v8r | 23 | 0 | 69.77s | |
✅ YAML | yamllint | 82 | 0 | 1.27s |
See detailed report in MegaLinter reports
814fd6c
to
29a746e
Compare
I haven't looked at the code much because I'm on vacation and from my cell phone but:
|
Definitely agree on both points. When you return from vacation, can you please either let me know what As an example, the |
EXTENDS accepts both absolute URLs and relative file paths to config files to inherit from. Stop assuming that all relative file paths are relative to the current workspace. This assumption does not hold when parsing a config inherited from a different repository. This situation arises most simply when A inherits from B via an absolute URL, and B inherits from C via a relative file path. Both inherited config files, B and C, are in a different repository than A. Make a best effort to infer the URL of the repository root, and use that to correctly resolve relative file paths within that repository recursively.
@Kurt-von-Laven I've been doing some research and it turns out that in Azure DevOps there is no "easy" way to get a raw url to a repository file. That is, there is no "raw" button like on GitHub. So there are 2 alternatives:
The following link discusses the 2 cases: https://stackoverflow.com/a/59547731 I imagine that the first case is the one to be addressed. |
@Kurt-von-Laven did you read my message? |
Sorry for the slow reply, @bdovaz. I am tempted, since we are doing a major release, to switch the format of How do folks feel about this (cc: @nvuillam, @echoix)? It would allow easy support for every file hosting platform I am familiar with (including Azure DevOps based on @bdovaz's helpful research), because we would always be able to determine the full URL to the MegaLinter file if it was not in the same repository. A config file in the same repo could be extended with The main alternatives I see if we prefer backwards compatibility are (a) the idea in the PR where we guess |
I agree with you that guessing is a recipe to at least understand it wrong once. As an advanced feature (less users) + a major version change, it's reasonable to try to do the right thing. Label as breaking, and we make sure to have it ready on time? |
@Kurt-von-Laven I'd be ok with such evolution, but I think it's better if we also keep ascending compatibility about configuration In the jsonschema you can define a property to be a simple string, or an object :) |
This pull request has been automatically marked as stale because it has not had recent activity. If you think this pull request should stay open, please remove the |
@Kurt-von-Laven are you still working on this? |
This pull request has been automatically marked as stale because it has not had recent activity. If you think this pull request should stay open, please remove the |
Is some one working on this @nvuillam - Can we use extends now with the current version ? |
@bheemvennapureddy extends works today with remote configs :) |
Fixes #2371.
EXTENDS
accepts both absolute URLs and relative file paths to config files to inherit from. Stop assuming that all relative file paths are relative to the current workspace. This assumption does not hold when parsing a config inherited from a different repository. This situation arises most simply when A inherits from B via an absolute URL, and B inherits from C via a relative file path. Both inherited config files, B and C, are in a different repository than A.Proposed Changes
combine_config
.download_config
, and reuse it.pathlib.Path
to the low-level, functionalos.path
.Readiness Checklist
Author/Contributor
Reviewing Maintainer
breaking
if this is a large fundamental changeautomation
,bug
,documentation
,enhancement
,infrastructure
, orperformance