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

fix(core): raise an error when invalid config extension is passed #4949

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

ematipico
Copy link
Member

Summary

Closes #4936

I also took the opportunity to refactor the methods that we use for auto search and loading user configuration:

  • the auto search now works only for one single file, instead of accepting multiple files. This reduces the cognitive complexity, it doesn't raise diagnostic and we use a single loop,
  • the logic we had in the auto search regarding "should_emit_error" was introduced only when searching for configuration files, however we raise an error only when the user provide --config-path, which doesn't trigger an auto-search.
  • the loading of user configuration has been moved into its own function with its own logic, which must raise an error if we can't find a configuration file
  • I refactored load_editorconfig and reduced its cognitive complexity. We now use a more functional approach to map the fields we need to validate.

Test Plan

Added new tests and updated the existing ones

@ematipico ematipico requested review from a team January 23, 2025 11:43
@github-actions github-actions bot added A-CLI Area: CLI A-Core Area: core A-Project Area: project A-LSP Area: language server protocol labels Jan 23, 2025
@ematipico ematipico merged commit 7b91d19 into next Jan 25, 2025
10 checks passed
@ematipico ematipico deleted the fix/disallow-arbitrary-extensions branch January 25, 2025 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI A-Core Area: core A-LSP Area: language server protocol A-Project Area: project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emit a warning when biome.json and biome.jsonc are located in the same folder
4 participants