[flake8-pytest-style] Fix defaults when lint.flake8-pytest-style config section is empty (PT001, PT023)#13292
Merged
AlexWaygood merged 2 commits intoastral-sh:ruff-0.7from Oct 8, 2024
Conversation
…yle.*-parentheses` config (`PT001`, `PT023`)
flake8-pytest-style] Fix defaults for missing lint.flake8-pytest-style.*-parentheses configs (PT001, PT023)flake8-pytest-style] Fix defaults when lint.flake8-pytest-style config section is empty (PT001, PT023)
Contributor
|
AlexWaygood
approved these changes
Sep 9, 2024
Member
AlexWaygood
left a comment
There was a problem hiding this comment.
LGTM! Sorry we didn't catch this, that's on us :-(
Unfortunately, however, this is will be a breaking change for some users, so we'll have to merge this as part of the 0.7 release. That should come at some point in the next few weeks, though; shouldn't be too long to wait :)
AlexWaygood
pushed a commit
that referenced
this pull request
Oct 17, 2024
…config section is empty (`PT001`, `PT023`) (#13292)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The documentation states that
lint.flake8-pytest-style.*-parenthesesoptions default tofalse, but if the user provides an empty[lint.flake8-pytest-style]config section, those options are suddenly set totrue.This is a bug. After #12838 changed the defaults,
Flake8PytestStyleOptions::try_into_settingswasn't updated and still relies on the preview mode to set the defaults.Reproduction
Test Plan
Manual testing, see reproduction section.
Given the fact that this was the only reference to
ruff_linter::settings::types::PreviewModeincrates/ruff_workspace/src/options.rs, looks like no other settings depend on the preview mode, and it doesn't make much sense to me to write any additional tests that verify there's no interaction between preview mode and other default values.