Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/ruff_server/src/session/index/ruff_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ impl<'a> ConfigurationTransformer for EditorConfigurationTransformer<'a> {
select,
extend_select,
ignore,
unfixable,
exclude,
line_length,
configuration_preference,
Expand All @@ -260,6 +261,7 @@ impl<'a> ConfigurationTransformer for EditorConfigurationTransformer<'a> {
select,
extend_select: extend_select.unwrap_or_default(),
ignore: ignore.unwrap_or_default(),
unfixable: unfixable.unwrap_or_default(),
..RuleSelection::default()
}],
..LintConfiguration::default()
Expand Down
19 changes: 19 additions & 0 deletions crates/ruff_server/src/session/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub(crate) struct ResolvedEditorSettings {
pub(super) select: Option<Vec<RuleSelector>>,
pub(super) extend_select: Option<Vec<RuleSelector>>,
pub(super) ignore: Option<Vec<RuleSelector>>,
pub(super) unfixable: Option<Vec<RuleSelector>>,
pub(super) exclude: Option<Vec<String>>,
pub(super) line_length: Option<LineLength>,
pub(super) configuration_preference: ConfigurationPreference,
Expand Down Expand Up @@ -130,6 +131,7 @@ struct LintOptions {
select: Option<Vec<String>>,
extend_select: Option<Vec<String>>,
ignore: Option<Vec<String>>,
unfixable: Option<Vec<String>>,
}

impl LintOptions {
Expand Down Expand Up @@ -348,6 +350,16 @@ impl ResolvedClientSettings {
.map(|rule| RuleSelector::from_str(rule).ok())
.collect()
}),
unfixable: Self::resolve_optional(all_settings, |settings| {
settings
.lint
.as_ref()?
.unfixable
.as_ref()?
.iter()
.map(|rule| RuleSelector::from_str(rule).ok())
.collect()
}),
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(
Expand Down Expand Up @@ -480,6 +492,7 @@ mod tests {
),
extend_select: None,
ignore: None,
unfixable: None,
},
),
format: Some(
Expand Down Expand Up @@ -535,6 +548,7 @@ mod tests {
select: None,
extend_select: None,
ignore: None,
unfixable: None,
},
),
format: Some(
Expand Down Expand Up @@ -603,6 +617,7 @@ mod tests {
select: None,
extend_select: None,
ignore: None,
unfixable: None,
},
),
format: Some(
Expand Down Expand Up @@ -691,6 +706,7 @@ mod tests {
]),
extend_select: None,
ignore: None,
unfixable: None,
exclude: None,
line_length: None,
configuration_preference: ConfigurationPreference::default(),
Expand Down Expand Up @@ -723,6 +739,7 @@ mod tests {
]),
extend_select: None,
ignore: None,
unfixable: None,
exclude: None,
line_length: None,
configuration_preference: ConfigurationPreference::EditorFirst,
Expand Down Expand Up @@ -754,6 +771,7 @@ mod tests {
"RUF001",
],
),
unfixable: None,
},
),
format: None,
Expand Down Expand Up @@ -815,6 +833,7 @@ mod tests {
select: None,
extend_select: None,
ignore: Some(vec![RuleSelector::from_str("RUF001").unwrap()]),
unfixable: None,
exclude: Some(vec!["third_party".into()]),
line_length: Some(LineLength::try_from(80).unwrap()),
configuration_preference: ConfigurationPreference::EditorFirst,
Expand Down
8 changes: 4 additions & 4 deletions docs/editors/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,9 @@ Rules to disable by default. See [the documentation](https://docs.astral.sh/ruff
}
```

### `extendIgnore`
### `unfixable`
Comment thread
dhruvmanila marked this conversation as resolved.

Rules to disable in addition to those in [`lint.ignore`](#ignore).
Rules for which fixes should be disabled default. See [the documentation](https://docs.astral.sh/ruff/settings/#unfixable).

**Default value**: `null`

Expand All @@ -510,7 +510,7 @@ Rules to disable in addition to those in [`lint.ignore`](#ignore).
=== "VS Code"
```json
{
"ruff.lint.extendIgnore": ["W1"]
"ruff.lint.unfixable": ["F401"]
}
```

Expand All @@ -520,7 +520,7 @@ Rules to disable in addition to those in [`lint.ignore`](#ignore).
init_options = {
settings = {
lint = {
extendIgnore = {"W1"}
ignore = {"F401"}
}
}
}
Expand Down