mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
[flake8-pytest-style
] Fix defaults when lint.flake8-pytest-style
config section is empty (PT001
, PT023
) (#13292)
This commit is contained in:
parent
d1e15f6246
commit
2b87587ac2
2 changed files with 5 additions and 10 deletions
|
@ -347,9 +347,7 @@ impl Configuration {
|
|||
.unwrap_or_default(),
|
||||
flake8_pytest_style: lint
|
||||
.flake8_pytest_style
|
||||
.map(|options| {
|
||||
Flake8PytestStyleOptions::try_into_settings(options, lint_preview)
|
||||
})
|
||||
.map(Flake8PytestStyleOptions::try_into_settings)
|
||||
.transpose()?
|
||||
.unwrap_or_default(),
|
||||
flake8_quotes: lint
|
||||
|
|
|
@ -27,7 +27,7 @@ use ruff_linter::rules::{
|
|||
pycodestyle, pydocstyle, pyflakes, pylint, pyupgrade, ruff,
|
||||
};
|
||||
use ruff_linter::settings::types::{
|
||||
IdentifierPattern, OutputFormat, PreviewMode, PythonVersion, RequiredVersion,
|
||||
IdentifierPattern, OutputFormat, PythonVersion, RequiredVersion,
|
||||
};
|
||||
use ruff_linter::{warn_user_once, RuleSelector};
|
||||
use ruff_macros::{CombineOptions, OptionsMetadata};
|
||||
|
@ -1500,12 +1500,9 @@ pub struct Flake8PytestStyleOptions {
|
|||
}
|
||||
|
||||
impl Flake8PytestStyleOptions {
|
||||
pub fn try_into_settings(
|
||||
self,
|
||||
preview: PreviewMode,
|
||||
) -> anyhow::Result<flake8_pytest_style::settings::Settings> {
|
||||
pub fn try_into_settings(self) -> anyhow::Result<flake8_pytest_style::settings::Settings> {
|
||||
Ok(flake8_pytest_style::settings::Settings {
|
||||
fixture_parentheses: self.fixture_parentheses.unwrap_or(preview.is_disabled()),
|
||||
fixture_parentheses: self.fixture_parentheses.unwrap_or_default(),
|
||||
parametrize_names_type: self.parametrize_names_type.unwrap_or_default(),
|
||||
parametrize_values_type: self.parametrize_values_type.unwrap_or_default(),
|
||||
parametrize_values_row_type: self.parametrize_values_row_type.unwrap_or_default(),
|
||||
|
@ -1531,7 +1528,7 @@ impl Flake8PytestStyleOptions {
|
|||
.transpose()
|
||||
.map_err(SettingsError::InvalidRaisesExtendRequireMatchFor)?
|
||||
.unwrap_or_default(),
|
||||
mark_parentheses: self.mark_parentheses.unwrap_or(preview.is_disabled()),
|
||||
mark_parentheses: self.mark_parentheses.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue