mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +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())
|
||||
.collect()
|
||||
}),
|
||||
exclude: Self::resolve_optional(all_settings, |settings| {
|
||||
Some(settings.exclude.as_ref()?.clone())
|
||||
}),
|
||||
exclude: Self::resolve_optional(all_settings, |settings| settings.exclude.clone()),
|
||||
line_length: Self::resolve_optional(all_settings, |settings| settings.line_length),
|
||||
configuration_preference: Self::resolve_or(
|
||||
all_settings,
|
||||
|
|
|
@ -18,9 +18,9 @@ use crate::session::settings::{ConfigurationPreference, ResolvedEditorSettings};
|
|||
|
||||
#[derive(Default)]
|
||||
pub(crate) struct RuffSettings {
|
||||
// settings to pass into the ruff linter
|
||||
/// Settings to pass into the Ruff linter.
|
||||
linter: ruff_linter::settings::LinterSettings,
|
||||
// settings to pass into the ruff formatter
|
||||
/// Settings to pass into the Ruff formatter.
|
||||
formatter: ruff_workspace::FormatterSettings,
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,10 @@ impl RuffSettingsIndex {
|
|||
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()
|
||||
}
|
||||
|
@ -127,10 +130,7 @@ impl RuffSettingsIndex {
|
|||
struct EditorConfigurationTransformer<'a>(&'a ResolvedEditorSettings, &'a Path);
|
||||
|
||||
impl<'a> ConfigurationTransformer for EditorConfigurationTransformer<'a> {
|
||||
fn transform(
|
||||
&self,
|
||||
filesystem_configuration: ruff_workspace::configuration::Configuration,
|
||||
) -> ruff_workspace::configuration::Configuration {
|
||||
fn transform(&self, filesystem_configuration: Configuration) -> Configuration {
|
||||
let ResolvedEditorSettings {
|
||||
configuration,
|
||||
format_preview,
|
||||
|
@ -152,13 +152,13 @@ impl<'a> ConfigurationTransformer for EditorConfigurationTransformer<'a> {
|
|||
select,
|
||||
extend_select: extend_select.unwrap_or_default(),
|
||||
ignore: ignore.unwrap_or_default(),
|
||||
..Default::default()
|
||||
..RuleSelection::default()
|
||||
}],
|
||||
..Default::default()
|
||||
..LintConfiguration::default()
|
||||
},
|
||||
format: FormatConfiguration {
|
||||
preview: format_preview.map(PreviewMode::from),
|
||||
..Default::default()
|
||||
..FormatConfiguration::default()
|
||||
},
|
||||
exclude: exclude.map(|exclude| {
|
||||
exclude
|
||||
|
@ -170,7 +170,7 @@ impl<'a> ConfigurationTransformer for EditorConfigurationTransformer<'a> {
|
|||
.collect()
|
||||
}),
|
||||
line_length,
|
||||
..Default::default()
|
||||
..Configuration::default()
|
||||
};
|
||||
|
||||
// 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) {
|
||||
Ok(config_from_file) => editor_configuration.combine(config_from_file),
|
||||
Err(err) => {
|
||||
tracing::error!("Unable to find editor-specified configuration file {err}");
|
||||
tracing::error!("Unable to find editor-specified configuration file: {err}");
|
||||
editor_configuration
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue