mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-17 19:27:11 +00:00
Fix preview snaps; cargo clippy
This commit is contained in:
parent
17bbb535de
commit
924fd61627
12 changed files with 27 additions and 49 deletions
|
|
@ -142,18 +142,14 @@ linter.flake8_import_conventions.aliases = {
|
|||
pandas = pd,
|
||||
panel = pn,
|
||||
plotly.express = px,
|
||||
plotly.graph_objects = go,
|
||||
polars = pl,
|
||||
pyarrow = pa,
|
||||
seaborn = sns,
|
||||
statsmodels.api = sm,
|
||||
tensorflow = tf,
|
||||
tkinter = tk,
|
||||
xml.etree.ElementTree = ET,
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {
|
||||
geopandas = [gpd],
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {}
|
||||
linter.flake8_import_conventions.banned_from = []
|
||||
linter.flake8_pytest_style.fixture_parentheses = false
|
||||
linter.flake8_pytest_style.parametrize_names_type = tuple
|
||||
|
|
|
|||
|
|
@ -144,18 +144,14 @@ linter.flake8_import_conventions.aliases = {
|
|||
pandas = pd,
|
||||
panel = pn,
|
||||
plotly.express = px,
|
||||
plotly.graph_objects = go,
|
||||
polars = pl,
|
||||
pyarrow = pa,
|
||||
seaborn = sns,
|
||||
statsmodels.api = sm,
|
||||
tensorflow = tf,
|
||||
tkinter = tk,
|
||||
xml.etree.ElementTree = ET,
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {
|
||||
geopandas = [gpd],
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {}
|
||||
linter.flake8_import_conventions.banned_from = []
|
||||
linter.flake8_pytest_style.fixture_parentheses = false
|
||||
linter.flake8_pytest_style.parametrize_names_type = tuple
|
||||
|
|
|
|||
|
|
@ -146,18 +146,14 @@ linter.flake8_import_conventions.aliases = {
|
|||
pandas = pd,
|
||||
panel = pn,
|
||||
plotly.express = px,
|
||||
plotly.graph_objects = go,
|
||||
polars = pl,
|
||||
pyarrow = pa,
|
||||
seaborn = sns,
|
||||
statsmodels.api = sm,
|
||||
tensorflow = tf,
|
||||
tkinter = tk,
|
||||
xml.etree.ElementTree = ET,
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {
|
||||
geopandas = [gpd],
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {}
|
||||
linter.flake8_import_conventions.banned_from = []
|
||||
linter.flake8_pytest_style.fixture_parentheses = false
|
||||
linter.flake8_pytest_style.parametrize_names_type = tuple
|
||||
|
|
|
|||
|
|
@ -143,18 +143,14 @@ linter.flake8_import_conventions.aliases = {
|
|||
pandas = pd,
|
||||
panel = pn,
|
||||
plotly.express = px,
|
||||
plotly.graph_objects = go,
|
||||
polars = pl,
|
||||
pyarrow = pa,
|
||||
seaborn = sns,
|
||||
statsmodels.api = sm,
|
||||
tensorflow = tf,
|
||||
tkinter = tk,
|
||||
xml.etree.ElementTree = ET,
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {
|
||||
geopandas = [gpd],
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {}
|
||||
linter.flake8_import_conventions.banned_from = []
|
||||
linter.flake8_pytest_style.fixture_parentheses = false
|
||||
linter.flake8_pytest_style.parametrize_names_type = tuple
|
||||
|
|
|
|||
|
|
@ -143,18 +143,14 @@ linter.flake8_import_conventions.aliases = {
|
|||
pandas = pd,
|
||||
panel = pn,
|
||||
plotly.express = px,
|
||||
plotly.graph_objects = go,
|
||||
polars = pl,
|
||||
pyarrow = pa,
|
||||
seaborn = sns,
|
||||
statsmodels.api = sm,
|
||||
tensorflow = tf,
|
||||
tkinter = tk,
|
||||
xml.etree.ElementTree = ET,
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {
|
||||
geopandas = [gpd],
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {}
|
||||
linter.flake8_import_conventions.banned_from = []
|
||||
linter.flake8_pytest_style.fixture_parentheses = false
|
||||
linter.flake8_pytest_style.parametrize_names_type = tuple
|
||||
|
|
|
|||
|
|
@ -142,18 +142,14 @@ linter.flake8_import_conventions.aliases = {
|
|||
pandas = pd,
|
||||
panel = pn,
|
||||
plotly.express = px,
|
||||
plotly.graph_objects = go,
|
||||
polars = pl,
|
||||
pyarrow = pa,
|
||||
seaborn = sns,
|
||||
statsmodels.api = sm,
|
||||
tensorflow = tf,
|
||||
tkinter = tk,
|
||||
xml.etree.ElementTree = ET,
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {
|
||||
geopandas = [gpd],
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {}
|
||||
linter.flake8_import_conventions.banned_from = []
|
||||
linter.flake8_pytest_style.fixture_parentheses = false
|
||||
linter.flake8_pytest_style.parametrize_names_type = tuple
|
||||
|
|
|
|||
|
|
@ -142,18 +142,14 @@ linter.flake8_import_conventions.aliases = {
|
|||
pandas = pd,
|
||||
panel = pn,
|
||||
plotly.express = px,
|
||||
plotly.graph_objects = go,
|
||||
polars = pl,
|
||||
pyarrow = pa,
|
||||
seaborn = sns,
|
||||
statsmodels.api = sm,
|
||||
tensorflow = tf,
|
||||
tkinter = tk,
|
||||
xml.etree.ElementTree = ET,
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {
|
||||
geopandas = [gpd],
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {}
|
||||
linter.flake8_import_conventions.banned_from = []
|
||||
linter.flake8_pytest_style.fixture_parentheses = false
|
||||
linter.flake8_pytest_style.parametrize_names_type = tuple
|
||||
|
|
|
|||
|
|
@ -142,18 +142,14 @@ linter.flake8_import_conventions.aliases = {
|
|||
pandas = pd,
|
||||
panel = pn,
|
||||
plotly.express = px,
|
||||
plotly.graph_objects = go,
|
||||
polars = pl,
|
||||
pyarrow = pa,
|
||||
seaborn = sns,
|
||||
statsmodels.api = sm,
|
||||
tensorflow = tf,
|
||||
tkinter = tk,
|
||||
xml.etree.ElementTree = ET,
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {
|
||||
geopandas = [gpd],
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {}
|
||||
linter.flake8_import_conventions.banned_from = []
|
||||
linter.flake8_pytest_style.fixture_parentheses = false
|
||||
linter.flake8_pytest_style.parametrize_names_type = tuple
|
||||
|
|
|
|||
|
|
@ -255,18 +255,14 @@ linter.flake8_import_conventions.aliases = {
|
|||
pandas = pd,
|
||||
panel = pn,
|
||||
plotly.express = px,
|
||||
plotly.graph_objects = go,
|
||||
polars = pl,
|
||||
pyarrow = pa,
|
||||
seaborn = sns,
|
||||
statsmodels.api = sm,
|
||||
tensorflow = tf,
|
||||
tkinter = tk,
|
||||
xml.etree.ElementTree = ET,
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {
|
||||
geopandas = [gpd],
|
||||
}
|
||||
linter.flake8_import_conventions.banned_aliases = {}
|
||||
linter.flake8_import_conventions.banned_from = []
|
||||
linter.flake8_pytest_style.fixture_parentheses = false
|
||||
linter.flake8_pytest_style.parametrize_names_type = tuple
|
||||
|
|
|
|||
|
|
@ -90,6 +90,18 @@ pub fn preview_banned_aliases() -> FxHashMap<String, BannedAliases> {
|
|||
)])
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
/// Merge preview aliases and banned aliases into the settings if preview mode is enabled.
|
||||
#[must_use]
|
||||
pub fn with_preview(mut self, preview_enabled: bool) -> Self {
|
||||
if preview_enabled {
|
||||
self.aliases.extend(preview_aliases());
|
||||
self.banned_aliases.extend(preview_banned_aliases());
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
|
|
|||
|
|
@ -247,12 +247,16 @@ impl Configuration {
|
|||
.map(IsortOptions::try_into_settings)
|
||||
.transpose()?
|
||||
.unwrap_or_default();
|
||||
let flake8_import_conventions = lint
|
||||
let mut flake8_import_conventions = lint
|
||||
.flake8_import_conventions
|
||||
.map(Flake8ImportConventionsOptions::try_into_settings)
|
||||
.transpose()?
|
||||
.unwrap_or_default();
|
||||
|
||||
// Merge preview aliases and banned aliases when preview mode is enabled
|
||||
flake8_import_conventions =
|
||||
flake8_import_conventions.with_preview(matches!(lint_preview, PreviewMode::Enabled));
|
||||
|
||||
conflicting_import_settings(&isort, &flake8_import_conventions)?;
|
||||
|
||||
let future_annotations = lint.future_annotations.unwrap_or_default();
|
||||
|
|
|
|||
|
|
@ -1685,9 +1685,7 @@ impl Flake8ImportConventionsOptions {
|
|||
|
||||
Ok(flake8_import_conventions::settings::Settings {
|
||||
aliases: normalized_aliases,
|
||||
banned_aliases: self
|
||||
.banned_aliases
|
||||
.unwrap_or_else(FxHashMap::default),
|
||||
banned_aliases: self.banned_aliases.unwrap_or_default(),
|
||||
banned_from: self.banned_from.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue