mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 15:15:33 +00:00
Touch-up error messages in server file discovery (#11285)
## Summary Just making these messages a little more consistent with how we format them in Ruff, uv, etc.
This commit is contained in:
parent
a8a97291d1
commit
9db11dcce2
2 changed files with 13 additions and 15 deletions
|
@ -274,9 +274,7 @@ impl ResolvedClientSettings {
|
||||||
.map(|rule| RuleSelector::from_str(rule).ok())
|
.map(|rule| RuleSelector::from_str(rule).ok())
|
||||||
.collect()
|
.collect()
|
||||||
}),
|
}),
|
||||||
exclude: Self::resolve_optional(all_settings, |settings| {
|
exclude: Self::resolve_optional(all_settings, |settings| settings.exclude.clone()),
|
||||||
Some(settings.exclude.as_ref()?.clone())
|
|
||||||
}),
|
|
||||||
line_length: Self::resolve_optional(all_settings, |settings| settings.line_length),
|
line_length: Self::resolve_optional(all_settings, |settings| settings.line_length),
|
||||||
configuration_preference: Self::resolve_or(
|
configuration_preference: Self::resolve_or(
|
||||||
all_settings,
|
all_settings,
|
||||||
|
|
|
@ -18,9 +18,9 @@ use crate::session::settings::{ConfigurationPreference, ResolvedEditorSettings};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub(crate) struct RuffSettings {
|
pub(crate) struct RuffSettings {
|
||||||
// settings to pass into the ruff linter
|
/// Settings to pass into the Ruff linter.
|
||||||
linter: ruff_linter::settings::LinterSettings,
|
linter: ruff_linter::settings::LinterSettings,
|
||||||
// settings to pass into the ruff formatter
|
/// Settings to pass into the Ruff formatter.
|
||||||
formatter: ruff_workspace::FormatterSettings,
|
formatter: ruff_workspace::FormatterSettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,10 @@ impl RuffSettingsIndex {
|
||||||
return settings.clone();
|
return settings.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
tracing::info!("No ruff settings file (pyproject.toml/ruff.toml/.ruff.toml) found for {} - falling back to default configuration", document_path.display());
|
tracing::info!(
|
||||||
|
"No Ruff settings file found for {}; falling back to default configuration",
|
||||||
|
document_path.display()
|
||||||
|
);
|
||||||
|
|
||||||
self.fallback.clone()
|
self.fallback.clone()
|
||||||
}
|
}
|
||||||
|
@ -127,10 +130,7 @@ impl RuffSettingsIndex {
|
||||||
struct EditorConfigurationTransformer<'a>(&'a ResolvedEditorSettings, &'a Path);
|
struct EditorConfigurationTransformer<'a>(&'a ResolvedEditorSettings, &'a Path);
|
||||||
|
|
||||||
impl<'a> ConfigurationTransformer for EditorConfigurationTransformer<'a> {
|
impl<'a> ConfigurationTransformer for EditorConfigurationTransformer<'a> {
|
||||||
fn transform(
|
fn transform(&self, filesystem_configuration: Configuration) -> Configuration {
|
||||||
&self,
|
|
||||||
filesystem_configuration: ruff_workspace::configuration::Configuration,
|
|
||||||
) -> ruff_workspace::configuration::Configuration {
|
|
||||||
let ResolvedEditorSettings {
|
let ResolvedEditorSettings {
|
||||||
configuration,
|
configuration,
|
||||||
format_preview,
|
format_preview,
|
||||||
|
@ -152,13 +152,13 @@ impl<'a> ConfigurationTransformer for EditorConfigurationTransformer<'a> {
|
||||||
select,
|
select,
|
||||||
extend_select: extend_select.unwrap_or_default(),
|
extend_select: extend_select.unwrap_or_default(),
|
||||||
ignore: ignore.unwrap_or_default(),
|
ignore: ignore.unwrap_or_default(),
|
||||||
..Default::default()
|
..RuleSelection::default()
|
||||||
}],
|
}],
|
||||||
..Default::default()
|
..LintConfiguration::default()
|
||||||
},
|
},
|
||||||
format: FormatConfiguration {
|
format: FormatConfiguration {
|
||||||
preview: format_preview.map(PreviewMode::from),
|
preview: format_preview.map(PreviewMode::from),
|
||||||
..Default::default()
|
..FormatConfiguration::default()
|
||||||
},
|
},
|
||||||
exclude: exclude.map(|exclude| {
|
exclude: exclude.map(|exclude| {
|
||||||
exclude
|
exclude
|
||||||
|
@ -170,7 +170,7 @@ impl<'a> ConfigurationTransformer for EditorConfigurationTransformer<'a> {
|
||||||
.collect()
|
.collect()
|
||||||
}),
|
}),
|
||||||
line_length,
|
line_length,
|
||||||
..Default::default()
|
..Configuration::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Merge in the editor-specified configuration file, if it exists.
|
// Merge in the editor-specified configuration file, if it exists.
|
||||||
|
@ -178,7 +178,7 @@ impl<'a> ConfigurationTransformer for EditorConfigurationTransformer<'a> {
|
||||||
match open_configuration_file(&config_file_path, project_root) {
|
match open_configuration_file(&config_file_path, project_root) {
|
||||||
Ok(config_from_file) => editor_configuration.combine(config_from_file),
|
Ok(config_from_file) => editor_configuration.combine(config_from_file),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
tracing::error!("Unable to find editor-specified configuration file {err}");
|
tracing::error!("Unable to find editor-specified configuration file: {err}");
|
||||||
editor_configuration
|
editor_configuration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue