Skip to content
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

MegaLinter ignores linter config in workspace when LINTER_RULES_PATH is set #4254

Open
liblaf opened this issue Nov 14, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@liblaf
Copy link

liblaf commented Nov 14, 2024

Describe the bug

I am expecting MegaLinter to search for linter config files in the following precedence:

  • GITHUB_WORKSPACE
  • LINTER_RULES_PATH
  • MegaLinter default config

However, MegaLinter seems to ignore config files in workspace when LINTER_RULES_PATH is set.

To Reproduce

Here is the demo workflow run.

Expected behavior

There should be no errors since F401 is ignored in .ruff.toml. However, .ruff.toml under repository root seems not to be used by MegaLinter.

Additional context

Setting PYTHON_RUFF_CONFIG_FILE: LINTER_DEFAULT in .mega-linter.yaml can solve the issue.

@liblaf liblaf added the bug Something isn't working label Nov 14, 2024
Copy link
Contributor

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 github-actions bot added the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Dec 15, 2024
@nvuillam
Copy link
Member

Is the probem still happening ? :)

@github-actions github-actions bot removed the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Dec 16, 2024
@liblaf
Copy link
Author

liblaf commented Dec 26, 2024

@nvuillam Yes. Here is a demo workflow run:

❌ Linted [PYTHON] files with [ruff]: Found 1 error(s) - (0.03s) (expand for details)
  - Using [ruff v0.8.0] https://megalinter.io/8.3.0/descriptors/python_ruff
  - MegaLinter key: [PYTHON_RUFF]
  - Rules config: [https://github.com/liblaf/.github/raw/refs/heads/main/.github/linters/.ruff.toml]
  - Number of files analyzed: [1]
  - Command: [ruff check --fix --no-fix --config /github/workspace/.ruff.toml --output-format sarif --output-file /github/workspace/megalinter-reports/sarif/PYTHON_RUFF.sarif main.py]
  --Error detail:
  error: `os` imported but unused
  
  error: 1 errors emitted

Note the message Rules config: ..., you can see that MegaLinter uses the config from LINTER_RULES_PATH instead of that under GITHUB_WORKSPACE.

Is the .ruff.toml under GITHUB_WORKSPACE overwritten by the one from LINTER_RULES_PATH?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants