Skip to content
Merged
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
7 changes: 0 additions & 7 deletions crates/ruff_linter/src/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,6 @@ pub(crate) const fn is_future_required_preview_generics_enabled(settings: &Linte
settings.preview.is_enabled()
}

// https://github.com/astral-sh/ruff/pull/18683
pub(crate) const fn is_safe_super_call_with_parameters_fix_enabled(
settings: &LinterSettings,
) -> bool {
settings.preview.is_enabled()
}

// https://github.com/astral-sh/ruff/pull/19851
pub(crate) const fn is_maxsplit_without_separator_fix_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled()
Expand Down
1 change: 0 additions & 1 deletion crates/ruff_linter/src/rules/pyupgrade/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ mod tests {
Ok(())
}

#[test_case(Rule::SuperCallWithParameters, Path::new("UP008.py"))]
#[test_case(Rule::TypingTextStrAlias, Path::new("UP019.py"))]
fn rules_preview(rule_code: Rule, path: &Path) -> Result<()> {
let snapshot = format!("{}__preview", path.to_string_lossy());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use ruff_python_semantic::SemanticModel;
use ruff_text_size::{Ranged, TextSize};

use crate::checkers::ast::Checker;
use crate::preview::is_safe_super_call_with_parameters_fix_enabled;
use crate::{Edit, Fix, FixAvailability, Violation};

/// ## What it does
Expand Down Expand Up @@ -49,10 +48,6 @@ use crate::{Edit, Fix, FixAvailability, Violation};
/// This rule's fix is marked as unsafe because removing the arguments from a call
/// may delete comments that are attached to the arguments.
///
/// In [preview], the fix is marked safe if no comments are present.
///
/// [preview]: https://docs.astral.sh/ruff/preview/
///
/// ## References
/// - [Python documentation: `super`](https://docs.python.org/3/library/functions.html#super)
/// - [super/MRO, Python's most misunderstood feature.](https://www.youtube.com/watch?v=X1PQ7zzltz4)
Expand Down Expand Up @@ -186,12 +181,10 @@ pub(crate) fn super_call_with_parameters(checker: &Checker, call: &ast::ExprCall

// Only provide a fix if there are no keyword arguments, since super() doesn't accept keyword arguments
if call.arguments.keywords.is_empty() {
let applicability = if !checker.comment_ranges().intersects(call.arguments.range())
&& is_safe_super_call_with_parameters_fix_enabled(checker.settings())
{
Applicability::Safe
} else {
let applicability = if checker.comment_ranges().intersects(call.arguments.range()) {
Applicability::Unsafe
} else {
Applicability::Safe
};

diagnostic.set_fix(Fix::applicable_edit(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ help: Remove `super()` parameters
18 | super(Child, self).method # wrong
19 | super(
20 | Child,
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:18:14
Expand All @@ -40,7 +39,6 @@ help: Remove `super()` parameters
19 | super(
20 | Child,
21 | self,
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:19:14
Expand All @@ -66,7 +64,6 @@ help: Remove `super()` parameters
20 |
21 |
22 | class BaseClass:
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:36:14
Expand All @@ -86,7 +83,6 @@ help: Remove `super()` parameters
37 | super().f()
38 |
39 | def different_argument(self, other):
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:50:18
Expand All @@ -105,7 +101,6 @@ help: Remove `super()` parameters
51 | super().f()
52 |
53 | outer_argument()
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:74:14
Expand All @@ -125,7 +120,6 @@ help: Remove `super()` parameters
75 | super().f() # OK
76 |
77 |
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:92:14
Expand All @@ -144,7 +138,6 @@ help: Remove `super()` parameters
93 |
94 |
95 | # see: https://github.com/astral-sh/ruff/issues/18684
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:113:14
Expand Down Expand Up @@ -287,7 +280,6 @@ help: Remove `super()` parameters
144 |
145 | # See: https://github.com/astral-sh/ruff/issues/19357
146 | # Must be detected
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:154:23
Expand All @@ -308,7 +300,6 @@ help: Remove `super()` parameters
155 |
156 | class ChildD2(ParentD):
157 | def f(self):
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:159:23
Expand All @@ -329,7 +320,6 @@ help: Remove `super()` parameters
160 |
161 | class ChildD3(ParentD):
162 | def f(self):
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:163:23
Expand All @@ -349,7 +339,6 @@ help: Remove `super()` parameters
164 | super # Python injects __class__ into scope
165 |
166 | import builtins as builtins_alias
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:169:29
Expand All @@ -369,7 +358,6 @@ help: Remove `super()` parameters
170 | super # Python injects __class__ into scope
171 |
172 | class ChildD5(ParentD):
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:176:23
Expand All @@ -390,7 +378,6 @@ help: Remove `super()` parameters
177 |
178 | class ChildD6(ParentD):
179 | def f(self):
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:182:23
Expand All @@ -411,7 +398,6 @@ help: Remove `super()` parameters
183 |
184 | class ChildD7(ParentD):
185 | def f(self):
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:188:23
Expand All @@ -432,7 +418,6 @@ help: Remove `super()` parameters
189 |
190 | class ChildD8(ParentD):
191 | def f(self):
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:195:23
Expand All @@ -453,7 +438,6 @@ help: Remove `super()` parameters
196 |
197 | class ChildD9(ParentD):
198 | def f(self):
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:202:23
Expand All @@ -474,7 +458,6 @@ help: Remove `super()` parameters
203 |
204 | class ChildD10(ParentD):
205 | def f(self):
note: This is an unsafe fix and may change runtime behavior

UP008 [*] Use `super()` instead of `super(__class__, self)`
--> UP008.py:209:23
Expand All @@ -493,4 +476,3 @@ help: Remove `super()` parameters
210 |
211 |
212 | # Must be ignored
note: This is an unsafe fix and may change runtime behavior
Loading