Extend unnecessary-pass (PIE790) to include ellipses in preview (#8641)

## Summary

This PR extends `unnecessary-pass` (`PIE790`) to flag unnecessary
ellipsis expressions in addition to `pass` statements. A `pass` is
equivalent to a standalone `...`, so it feels correct to me that a
single rule should cover both cases.

When we look to v0.2.0, we should also consider deprecating `PYI013`,
which flags ellipses only for classes.

Closes https://github.com/astral-sh/ruff/issues/8602.
This commit is contained in:
Charlie Marsh 2023-11-13 11:28:16 -08:00 committed by GitHub
parent df9ade7fd9
commit 534fc34f11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 836 additions and 81 deletions

View file

@ -148,3 +148,32 @@ for i in range(10):
for i in range(10): for i in range(10):
pass # comment pass # comment
pass pass
def foo():
print("foo")
...
def foo():
"""A docstring."""
print("foo")
...
for i in range(10):
...
...
for i in range(10):
...
...
for i in range(10):
... # comment
...
for i in range(10):
...
pass

View file

@ -6,7 +6,7 @@ use crate::rules::flake8_pie;
/// Run lint rules over a suite of [`Stmt`] syntax nodes. /// Run lint rules over a suite of [`Stmt`] syntax nodes.
pub(crate) fn suite(suite: &[Stmt], checker: &mut Checker) { pub(crate) fn suite(suite: &[Stmt], checker: &mut Checker) {
if checker.enabled(Rule::UnnecessaryPass) { if checker.enabled(Rule::UnnecessaryPlaceholder) {
flake8_pie::rules::no_unnecessary_pass(checker, suite); flake8_pie::rules::unnecessary_placeholder(checker, suite);
} }
} }

View file

@ -768,7 +768,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
(Flake8PytestStyle, "027") => (RuleGroup::Stable, rules::flake8_pytest_style::rules::PytestUnittestRaisesAssertion), (Flake8PytestStyle, "027") => (RuleGroup::Stable, rules::flake8_pytest_style::rules::PytestUnittestRaisesAssertion),
// flake8-pie // flake8-pie
(Flake8Pie, "790") => (RuleGroup::Stable, rules::flake8_pie::rules::UnnecessaryPass), (Flake8Pie, "790") => (RuleGroup::Stable, rules::flake8_pie::rules::UnnecessaryPlaceholder),
(Flake8Pie, "794") => (RuleGroup::Stable, rules::flake8_pie::rules::DuplicateClassFieldDefinition), (Flake8Pie, "794") => (RuleGroup::Stable, rules::flake8_pie::rules::DuplicateClassFieldDefinition),
(Flake8Pie, "796") => (RuleGroup::Stable, rules::flake8_pie::rules::NonUniqueEnums), (Flake8Pie, "796") => (RuleGroup::Stable, rules::flake8_pie::rules::NonUniqueEnums),
(Flake8Pie, "800") => (RuleGroup::Stable, rules::flake8_pie::rules::UnnecessarySpread), (Flake8Pie, "800") => (RuleGroup::Stable, rules::flake8_pie::rules::UnnecessarySpread),

View file

@ -17,7 +17,7 @@ mod tests {
#[test_case(Rule::UnnecessaryDictKwargs, Path::new("PIE804.py"))] #[test_case(Rule::UnnecessaryDictKwargs, Path::new("PIE804.py"))]
#[test_case(Rule::MultipleStartsEndsWith, Path::new("PIE810.py"))] #[test_case(Rule::MultipleStartsEndsWith, Path::new("PIE810.py"))]
#[test_case(Rule::UnnecessaryRangeStart, Path::new("PIE808.py"))] #[test_case(Rule::UnnecessaryRangeStart, Path::new("PIE808.py"))]
#[test_case(Rule::UnnecessaryPass, Path::new("PIE790.py"))] #[test_case(Rule::UnnecessaryPlaceholder, Path::new("PIE790.py"))]
#[test_case(Rule::UnnecessarySpread, Path::new("PIE800.py"))] #[test_case(Rule::UnnecessarySpread, Path::new("PIE800.py"))]
#[test_case(Rule::ReimplementedContainerBuiltin, Path::new("PIE807.py"))] #[test_case(Rule::ReimplementedContainerBuiltin, Path::new("PIE807.py"))]
#[test_case(Rule::NonUniqueEnums, Path::new("PIE796.py"))] #[test_case(Rule::NonUniqueEnums, Path::new("PIE796.py"))]
@ -31,6 +31,7 @@ mod tests {
Ok(()) Ok(())
} }
#[test_case(Rule::UnnecessaryPlaceholder, Path::new("PIE790.py"))]
#[test_case(Rule::ReimplementedContainerBuiltin, Path::new("PIE807.py"))] #[test_case(Rule::ReimplementedContainerBuiltin, Path::new("PIE807.py"))]
fn preview_rules(rule_code: Rule, path: &Path) -> Result<()> { fn preview_rules(rule_code: Rule, path: &Path) -> Result<()> {
let snapshot = format!( let snapshot = format!(

View file

@ -3,7 +3,7 @@ pub(crate) use multiple_starts_ends_with::*;
pub(crate) use non_unique_enums::*; pub(crate) use non_unique_enums::*;
pub(crate) use reimplemented_container_builtin::*; pub(crate) use reimplemented_container_builtin::*;
pub(crate) use unnecessary_dict_kwargs::*; pub(crate) use unnecessary_dict_kwargs::*;
pub(crate) use unnecessary_pass::*; pub(crate) use unnecessary_placeholder::*;
pub(crate) use unnecessary_range_start::*; pub(crate) use unnecessary_range_start::*;
pub(crate) use unnecessary_spread::*; pub(crate) use unnecessary_spread::*;
@ -12,6 +12,6 @@ mod multiple_starts_ends_with;
mod non_unique_enums; mod non_unique_enums;
mod reimplemented_container_builtin; mod reimplemented_container_builtin;
mod unnecessary_dict_kwargs; mod unnecessary_dict_kwargs;
mod unnecessary_pass; mod unnecessary_placeholder;
mod unnecessary_range_start; mod unnecessary_range_start;
mod unnecessary_spread; mod unnecessary_spread;

View file

@ -1,75 +0,0 @@
use ruff_python_ast::Stmt;
use ruff_diagnostics::AlwaysFixableViolation;
use ruff_diagnostics::{Diagnostic, Edit, Fix};
use ruff_macros::{derive_message_formats, violation};
use ruff_python_ast::whitespace::trailing_comment_start_offset;
use ruff_text_size::Ranged;
use crate::checkers::ast::Checker;
use crate::fix;
/// ## What it does
/// Checks for unnecessary `pass` statements in functions, classes, and other
/// blocks.
///
/// ## Why is this bad?
/// In Python, the `pass` statement serves as a placeholder, allowing for
/// syntactically correct empty code blocks. The primary purpose of the `pass`
/// statement is to avoid syntax errors in situations where a statement is
/// syntactically required, but no code needs to be executed.
///
/// If a `pass` statement is present in a code block that includes at least
/// one other statement (even, e.g., a docstring), it is unnecessary and should
/// be removed.
///
/// ## Example
/// ```python
/// def func():
/// """Placeholder docstring."""
/// pass
/// ```
///
/// Use instead:
/// ```python
/// def func():
/// """Placeholder docstring."""
/// ```
///
/// ## References
/// - [Python documentation: The `pass` statement](https://docs.python.org/3/reference/simple_stmts.html#the-pass-statement)
#[violation]
pub struct UnnecessaryPass;
impl AlwaysFixableViolation for UnnecessaryPass {
#[derive_message_formats]
fn message(&self) -> String {
format!("Unnecessary `pass` statement")
}
fn fix_title(&self) -> String {
"Remove unnecessary `pass`".to_string()
}
}
/// PIE790
pub(crate) fn no_unnecessary_pass(checker: &mut Checker, body: &[Stmt]) {
if body.len() < 2 {
return;
}
body.iter()
.filter(|stmt| stmt.is_pass_stmt())
.for_each(|stmt| {
let mut diagnostic = Diagnostic::new(UnnecessaryPass, stmt.range());
let edit = if let Some(index) = trailing_comment_start_offset(stmt, checker.locator()) {
Edit::range_deletion(stmt.range().add_end(index))
} else {
fix::edits::delete_stmt(stmt, None, checker.locator(), checker.indexer())
};
diagnostic.set_fix(Fix::safe_edit(edit).isolate(Checker::isolation(
checker.semantic().current_statement_id(),
)));
checker.diagnostics.push(diagnostic);
});
}

View file

@ -0,0 +1,127 @@
use ruff_diagnostics::AlwaysFixableViolation;
use ruff_diagnostics::{Diagnostic, Edit, Fix};
use ruff_macros::{derive_message_formats, violation};
use ruff_python_ast::whitespace::trailing_comment_start_offset;
use ruff_python_ast::Stmt;
use ruff_text_size::Ranged;
use crate::checkers::ast::Checker;
use crate::fix;
/// ## What it does
/// Checks for unnecessary `pass` statements in functions, classes, and other
/// blocks.
///
/// In [preview], this rule also checks for unnecessary ellipsis (`...`)
/// literals.
///
/// ## Why is this bad?
/// In Python, the `pass` statement and ellipsis (`...`) literal serve as
/// placeholders, allowing for syntactically correct empty code blocks. The
/// primary purpose of these nodes is to avoid syntax errors in situations
/// where a statement or expression is syntactically required, but no code
/// needs to be executed.
///
/// If a `pass` or ellipsis is present in a code block that includes at least
/// one other statement (even, e.g., a docstring), it is unnecessary and should
/// be removed.
///
/// ## Example
/// ```python
/// def func():
/// """Placeholder docstring."""
/// pass
/// ```
///
/// Use instead:
/// ```python
/// def func():
/// """Placeholder docstring."""
/// ```
///
/// In [preview]:
/// ```python
/// def func():
/// """Placeholder docstring."""
/// ...
/// ```
///
/// Use instead:
/// ```python
/// def func():
/// """Placeholder docstring."""
/// ```
///
/// ## References
/// - [Python documentation: The `pass` statement](https://docs.python.org/3/reference/simple_stmts.html#the-pass-statement)
///
/// [preview]: https://docs.astral.sh/ruff/preview/
#[violation]
pub struct UnnecessaryPlaceholder {
kind: Placeholder,
}
impl AlwaysFixableViolation for UnnecessaryPlaceholder {
#[derive_message_formats]
fn message(&self) -> String {
let Self { kind } = self;
match kind {
Placeholder::Pass => format!("Unnecessary `pass` statement"),
Placeholder::Ellipsis => format!("Unnecessary `...` literal"),
}
}
fn fix_title(&self) -> String {
let Self { kind } = self;
match kind {
Placeholder::Pass => format!("Remove unnecessary `pass`"),
Placeholder::Ellipsis => format!("Remove unnecessary `...`"),
}
}
}
/// PIE790
pub(crate) fn unnecessary_placeholder(checker: &mut Checker, body: &[Stmt]) {
if body.len() < 2 {
return;
}
for stmt in body {
let kind = match stmt {
Stmt::Pass(_) => Placeholder::Pass,
Stmt::Expr(expr)
if expr.value.is_ellipsis_literal_expr()
&& checker.settings.preview.is_enabled() =>
{
Placeholder::Ellipsis
}
_ => continue,
};
let mut diagnostic = Diagnostic::new(UnnecessaryPlaceholder { kind }, stmt.range());
let edit = if let Some(index) = trailing_comment_start_offset(stmt, checker.locator()) {
Edit::range_deletion(stmt.range().add_end(index))
} else {
fix::edits::delete_stmt(stmt, None, checker.locator(), checker.indexer())
};
diagnostic.set_fix(Fix::safe_edit(edit).isolate(Checker::isolation(
checker.semantic().current_statement_id(),
)));
checker.diagnostics.push(diagnostic);
}
}
#[derive(Debug, PartialEq, Eq)]
enum Placeholder {
Pass,
Ellipsis,
}
impl std::fmt::Display for Placeholder {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Self::Pass => fmt.write_str("pass"),
Self::Ellipsis => fmt.write_str("..."),
}
}
}

View file

@ -446,6 +446,8 @@ PIE790.py:149:5: PIE790 [*] Unnecessary `pass` statement
149 |- pass # comment 149 |- pass # comment
149 |+ # comment 149 |+ # comment
150 150 | pass 150 150 | pass
151 151 |
152 152 |
PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement
| |
@ -461,5 +463,23 @@ PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement
148 148 | for i in range(10): 148 148 | for i in range(10):
149 149 | pass # comment 149 149 | pass # comment
150 |- pass 150 |- pass
151 150 |
152 151 |
153 152 | def foo():
PIE790.py:179:5: PIE790 [*] Unnecessary `pass` statement
|
177 | for i in range(10):
178 | ...
179 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
176 176 |
177 177 | for i in range(10):
178 178 | ...
179 |- pass

View file

@ -0,0 +1,653 @@
---
source: crates/ruff_linter/src/rules/flake8_pie/mod.rs
---
PIE790.py:4:5: PIE790 [*] Unnecessary `pass` statement
|
2 | """buzz"""
3 |
4 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
1 1 | class Foo:
2 2 | """buzz"""
3 3 |
4 |- pass
5 4 |
6 5 |
7 6 | if foo:
PIE790.py:9:5: PIE790 [*] Unnecessary `pass` statement
|
7 | if foo:
8 | """foo"""
9 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
6 6 |
7 7 | if foo:
8 8 | """foo"""
9 |- pass
10 9 |
11 10 |
12 11 | def multi_statement() -> None:
PIE790.py:14:5: PIE790 [*] Unnecessary `pass` statement
|
12 | def multi_statement() -> None:
13 | """This is a function."""
14 | pass; print("hello")
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
11 11 |
12 12 | def multi_statement() -> None:
13 13 | """This is a function."""
14 |- pass; print("hello")
14 |+ print("hello")
15 15 |
16 16 |
17 17 | if foo:
PIE790.py:21:5: PIE790 [*] Unnecessary `pass` statement
|
19 | else:
20 | """bar"""
21 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
18 18 | pass
19 19 | else:
20 20 | """bar"""
21 |- pass
22 21 |
23 22 |
24 23 | while True:
PIE790.py:28:5: PIE790 [*] Unnecessary `pass` statement
|
26 | else:
27 | """bar"""
28 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
25 25 | pass
26 26 | else:
27 27 | """bar"""
28 |- pass
29 28 |
30 29 |
31 30 | for _ in range(10):
PIE790.py:35:5: PIE790 [*] Unnecessary `pass` statement
|
33 | else:
34 | """bar"""
35 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
32 32 | pass
33 33 | else:
34 34 | """bar"""
35 |- pass
36 35 |
37 36 |
38 37 | async for _ in range(10):
PIE790.py:42:5: PIE790 [*] Unnecessary `pass` statement
|
40 | else:
41 | """bar"""
42 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
39 39 | pass
40 40 | else:
41 41 | """bar"""
42 |- pass
43 42 |
44 43 |
45 44 | def foo() -> None:
PIE790.py:50:5: PIE790 [*] Unnecessary `pass` statement
|
48 | """
49 |
50 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
47 47 | buzz
48 48 | """
49 49 |
50 |- pass
51 50 |
52 51 |
53 52 | async def foo():
PIE790.py:58:5: PIE790 [*] Unnecessary `pass` statement
|
56 | """
57 |
58 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
55 55 | buzz
56 56 | """
57 57 |
58 |- pass
59 58 |
60 59 |
61 60 | try:
PIE790.py:65:5: PIE790 [*] Unnecessary `pass` statement
|
63 | buzz
64 | """
65 | pass
| ^^^^ PIE790
66 | except ValueError:
67 | pass
|
= help: Remove unnecessary `pass`
Safe fix
62 62 | """
63 63 | buzz
64 64 | """
65 |- pass
66 65 | except ValueError:
67 66 | pass
68 67 |
PIE790.py:74:5: PIE790 [*] Unnecessary `pass` statement
|
72 | except ValueError:
73 | """bar"""
74 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
71 71 | bar()
72 72 | except ValueError:
73 73 | """bar"""
74 |- pass
75 74 |
76 75 |
77 76 | for _ in range(10):
PIE790.py:79:5: PIE790 [*] Unnecessary `pass` statement
|
77 | for _ in range(10):
78 | """buzz"""
79 | pass
| ^^^^ PIE790
80 |
81 | async for _ in range(10):
|
= help: Remove unnecessary `pass`
Safe fix
76 76 |
77 77 | for _ in range(10):
78 78 | """buzz"""
79 |- pass
80 79 |
81 80 | async for _ in range(10):
82 81 | """buzz"""
PIE790.py:83:5: PIE790 [*] Unnecessary `pass` statement
|
81 | async for _ in range(10):
82 | """buzz"""
83 | pass
| ^^^^ PIE790
84 |
85 | while cond:
|
= help: Remove unnecessary `pass`
Safe fix
80 80 |
81 81 | async for _ in range(10):
82 82 | """buzz"""
83 |- pass
84 83 |
85 84 | while cond:
86 85 | """buzz"""
PIE790.py:87:5: PIE790 [*] Unnecessary `pass` statement
|
85 | while cond:
86 | """buzz"""
87 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
84 84 |
85 85 | while cond:
86 86 | """buzz"""
87 |- pass
88 87 |
89 88 |
90 89 | with bar:
PIE790.py:92:5: PIE790 [*] Unnecessary `pass` statement
|
90 | with bar:
91 | """buzz"""
92 | pass
| ^^^^ PIE790
93 |
94 | async with bar:
|
= help: Remove unnecessary `pass`
Safe fix
89 89 |
90 90 | with bar:
91 91 | """buzz"""
92 |- pass
93 92 |
94 93 | async with bar:
95 94 | """buzz"""
PIE790.py:96:5: PIE790 [*] Unnecessary `pass` statement
|
94 | async with bar:
95 | """buzz"""
96 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
93 93 |
94 94 | async with bar:
95 95 | """buzz"""
96 |- pass
97 96 |
98 97 |
99 98 | def foo() -> None:
PIE790.py:101:5: PIE790 [*] Unnecessary `pass` statement
|
99 | def foo() -> None:
100 | """buzz"""
101 | pass # bar
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
98 98 |
99 99 | def foo() -> None:
100 100 | """buzz"""
101 |- pass # bar
101 |+ # bar
102 102 |
103 103 |
104 104 | class Foo:
PIE790.py:130:5: PIE790 [*] Unnecessary `pass` statement
|
128 | def foo():
129 | print("foo")
130 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
127 127 |
128 128 | def foo():
129 129 | print("foo")
130 |- pass
131 130 |
132 131 |
133 132 | def foo():
PIE790.py:136:5: PIE790 [*] Unnecessary `pass` statement
|
134 | """A docstring."""
135 | print("foo")
136 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
133 133 | def foo():
134 134 | """A docstring."""
135 135 | print("foo")
136 |- pass
137 136 |
138 137 |
139 138 | for i in range(10):
PIE790.py:140:5: PIE790 [*] Unnecessary `pass` statement
|
139 | for i in range(10):
140 | pass
| ^^^^ PIE790
141 | pass
|
= help: Remove unnecessary `pass`
Safe fix
138 138 |
139 139 | for i in range(10):
140 140 | pass
141 |- pass
142 141 |
143 142 | for i in range(10):
144 143 | pass
PIE790.py:141:5: PIE790 [*] Unnecessary `pass` statement
|
139 | for i in range(10):
140 | pass
141 | pass
| ^^^^ PIE790
142 |
143 | for i in range(10):
|
= help: Remove unnecessary `pass`
Safe fix
138 138 |
139 139 | for i in range(10):
140 140 | pass
141 |- pass
142 141 |
143 142 | for i in range(10):
144 143 | pass
PIE790.py:144:5: PIE790 [*] Unnecessary `pass` statement
|
143 | for i in range(10):
144 | pass
| ^^^^ PIE790
145 |
146 | pass
|
= help: Remove unnecessary `pass`
Safe fix
141 141 | pass
142 142 |
143 143 | for i in range(10):
144 |- pass
145 144 |
146 145 | pass
147 146 |
PIE790.py:146:5: PIE790 [*] Unnecessary `pass` statement
|
144 | pass
145 |
146 | pass
| ^^^^ PIE790
147 |
148 | for i in range(10):
|
= help: Remove unnecessary `pass`
Safe fix
143 143 | for i in range(10):
144 144 | pass
145 145 |
146 |- pass
147 146 |
148 147 | for i in range(10):
149 148 | pass # comment
PIE790.py:149:5: PIE790 [*] Unnecessary `pass` statement
|
148 | for i in range(10):
149 | pass # comment
| ^^^^ PIE790
150 | pass
|
= help: Remove unnecessary `pass`
Safe fix
146 146 | pass
147 147 |
148 148 | for i in range(10):
149 |- pass # comment
149 |+ # comment
150 150 | pass
151 151 |
152 152 |
PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement
|
148 | for i in range(10):
149 | pass # comment
150 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
147 147 |
148 148 | for i in range(10):
149 149 | pass # comment
150 |- pass
151 150 |
152 151 |
153 152 | def foo():
PIE790.py:155:5: PIE790 [*] Unnecessary `...` literal
|
153 | def foo():
154 | print("foo")
155 | ...
| ^^^ PIE790
|
= help: Remove unnecessary `...`
Safe fix
152 152 |
153 153 | def foo():
154 154 | print("foo")
155 |- ...
156 155 |
157 156 |
158 157 | def foo():
PIE790.py:161:5: PIE790 [*] Unnecessary `...` literal
|
159 | """A docstring."""
160 | print("foo")
161 | ...
| ^^^ PIE790
|
= help: Remove unnecessary `...`
Safe fix
158 158 | def foo():
159 159 | """A docstring."""
160 160 | print("foo")
161 |- ...
162 161 |
163 162 |
164 163 | for i in range(10):
PIE790.py:165:5: PIE790 [*] Unnecessary `...` literal
|
164 | for i in range(10):
165 | ...
| ^^^ PIE790
166 | ...
|
= help: Remove unnecessary `...`
Safe fix
163 163 |
164 164 | for i in range(10):
165 165 | ...
166 |- ...
167 166 |
168 167 | for i in range(10):
169 168 | ...
PIE790.py:166:5: PIE790 [*] Unnecessary `...` literal
|
164 | for i in range(10):
165 | ...
166 | ...
| ^^^ PIE790
167 |
168 | for i in range(10):
|
= help: Remove unnecessary `...`
Safe fix
163 163 |
164 164 | for i in range(10):
165 165 | ...
166 |- ...
167 166 |
168 167 | for i in range(10):
169 168 | ...
PIE790.py:169:5: PIE790 [*] Unnecessary `...` literal
|
168 | for i in range(10):
169 | ...
| ^^^ PIE790
170 |
171 | ...
|
= help: Remove unnecessary `...`
Safe fix
166 166 | ...
167 167 |
168 168 | for i in range(10):
169 |- ...
170 169 |
171 170 | ...
172 171 |
PIE790.py:171:5: PIE790 [*] Unnecessary `...` literal
|
169 | ...
170 |
171 | ...
| ^^^ PIE790
172 |
173 | for i in range(10):
|
= help: Remove unnecessary `...`
Safe fix
168 168 | for i in range(10):
169 169 | ...
170 170 |
171 |- ...
172 171 |
173 172 | for i in range(10):
174 173 | ... # comment
PIE790.py:174:5: PIE790 [*] Unnecessary `...` literal
|
173 | for i in range(10):
174 | ... # comment
| ^^^ PIE790
175 | ...
|
= help: Remove unnecessary `...`
Safe fix
171 171 | ...
172 172 |
173 173 | for i in range(10):
174 |- ... # comment
174 |+ # comment
175 175 | ...
176 176 |
177 177 | for i in range(10):
PIE790.py:175:5: PIE790 [*] Unnecessary `...` literal
|
173 | for i in range(10):
174 | ... # comment
175 | ...
| ^^^ PIE790
176 |
177 | for i in range(10):
|
= help: Remove unnecessary `...`
Safe fix
172 172 |
173 173 | for i in range(10):
174 174 | ... # comment
175 |- ...
176 175 |
177 176 | for i in range(10):
178 177 | ...
PIE790.py:178:5: PIE790 [*] Unnecessary `...` literal
|
177 | for i in range(10):
178 | ...
| ^^^ PIE790
179 | pass
|
= help: Remove unnecessary `...`
Safe fix
175 175 | ...
176 176 |
177 177 | for i in range(10):
178 |- ...
179 178 | pass
PIE790.py:179:5: PIE790 [*] Unnecessary `pass` statement
|
177 | for i in range(10):
178 | ...
179 | pass
| ^^^^ PIE790
|
= help: Remove unnecessary `pass`
Safe fix
176 176 |
177 177 | for i in range(10):
178 178 | ...
179 |- pass