Skip to content

Comments

Add user_configuration_directory to System#16020

Merged
MichaReiser merged 3 commits intomainfrom
micha/system-user-configurationd-directory
Feb 10, 2025
Merged

Add user_configuration_directory to System#16020
MichaReiser merged 3 commits intomainfrom
micha/system-user-configurationd-directory

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Feb 7, 2025

Summary

This PR adds a new user_configuration_directory method to System. We need it to resolve where to lookup a user-level knot.toml configuration file.
The method belongs to System because not all platforms have a convention of where to store such configuration files (e.g. wasm).

I refactored TestSystem to be a simple wrapper around an Arc<dyn System...> and use the System.as_any method instead to cast it down to an InMemory system. I also removed some System specific methods from InMemoryFileSystem, they don't belong there.

This PR removes the os feature as a default feature from ruff_db. Most crates depending on ruff_db don't need it because they only depend on System or only depend on os for testing. This was necessary to fix a compile error with red_knot_wasm

Test Plan

I'll make use of the method in my next PR. So I guess we won't know if it works before then but I copied the code from Ruff/uv, so I have high confidence that it is correct.

cargo test

@MichaReiser MichaReiser added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Feb 7, 2025
@MichaReiser MichaReiser marked this pull request as ready for review February 7, 2025 13:12
@MichaReiser MichaReiser force-pushed the micha/system-user-configurationd-directory branch 2 times, most recently from 50e15b4 to 6b78710 Compare February 7, 2025 14:14
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Copy link
Contributor

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

Base automatically changed from micha/settings to main February 10, 2025 14:28
@MichaReiser MichaReiser force-pushed the micha/system-user-configurationd-directory branch from 6b78710 to 902cdb4 Compare February 10, 2025 14:41
@MichaReiser MichaReiser merged commit f7819e5 into main Feb 10, 2025
21 checks passed
@MichaReiser MichaReiser deleted the micha/system-user-configurationd-directory branch February 10, 2025 14:50
dcreager added a commit that referenced this pull request Feb 11, 2025
* main:
  add diagnostic `Span` (couples `File` and `TextRange`) (#16101)
  Remove `Hash` and `Eq` from `AstNodeRef` for types not implementing `Eq` or `Hash` (#16100)
  Fix release build warning about unused todo type message (#16102)
  [`pydocstyle`] Handle arguments with the same names as sections (`D417`) (#16011)
  [red-knot] Reduce usage of `From<Type>` implementations when working with `Symbol`s (#16076)
  Transition to salsa coarse-grained tracked structs (#15763)
  [`pyupgrade`] Handle micro version numbers correctly (`UP036`) (#16091)
  [red-knot] `T | object == object` (#16088)
  [`ruff`] Skip singleton starred expressions for `incorrectly-parenthesized-tuple-in-subscript` (`RUF031`) (#16083)
  Delete left-over `verbosity.rs (#16081)
  [red-knot] User-level configuration (#16021)
  Add `user_configuration_directory` to `System` (#16020)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants