config_io
ruff_sync.config_io ¶
Configuration file discovery and loading logic.
RuffConfigFileName ¶
Bases: str, Enum
Enumeration of Ruff configuration filenames.
Source code in src/ruff_sync/config_io.py
tried_order
classmethod
¶
Return the order in which configuration files should be tried.
is_ruff_toml_file ¶
Return True if the path or URL indicates a ruff.toml file.
This handles cases with query strings or fragments by examining only the path component.
Source code in src/ruff_sync/config_io.py
resolve_target_path ¶
Resolve the target path for configuration files.
If 'to' is a file, it's used directly. Otherwise, it looks for existing ruff/pyproject.toml in the 'to' directory. If none found, it defaults to pyproject.toml unless the first upstream is a ruff.toml.
Source code in src/ruff_sync/config_io.py
load_local_ruff_config ¶
Load the local Ruff configuration as a plain dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Path
|
The directory or file path to load configuration from. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A plain dictionary containing the [tool.ruff] configuration. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no configuration file is found at the target path. |
TypeError
|
If the configuration structure is invalid. |