Skip to content

Commit bbcddf7

Browse files
ntBreMichaReiser
authored andcommitted
[pylint] Stabilize len-test (PLC1802) (#16626)
Summary -- Stabilizes PLC1802. The tests were already in the right place, and I just tidied the docs a little bit. Test Plan -- 1 issue closed 4 days after the rule was added, no other issues
1 parent c387a51 commit bbcddf7

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

crates/ruff_linter/src/codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
192192
(Pylint, "C0208") => (RuleGroup::Stable, rules::pylint::rules::IterationOverSet),
193193
(Pylint, "C0414") => (RuleGroup::Stable, rules::pylint::rules::UselessImportAlias),
194194
(Pylint, "C0415") => (RuleGroup::Preview, rules::pylint::rules::ImportOutsideTopLevel),
195-
(Pylint, "C1802") => (RuleGroup::Preview, rules::pylint::rules::LenTest),
195+
(Pylint, "C1802") => (RuleGroup::Stable, rules::pylint::rules::LenTest),
196196
(Pylint, "C1901") => (RuleGroup::Preview, rules::pylint::rules::CompareToEmptyString),
197197
(Pylint, "C2401") => (RuleGroup::Stable, rules::pylint::rules::NonAsciiName),
198198
(Pylint, "C2403") => (RuleGroup::Stable, rules::pylint::rules::NonAsciiImportName),

crates/ruff_linter/src/rules/pylint/rules/len_test.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ use ruff_python_semantic::{BindingId, SemanticModel};
99
use ruff_text_size::Ranged;
1010

1111
/// ## What it does
12-
/// Checks for usage of call of 'len' on sequences
13-
/// in boolean test context.
12+
/// Checks for `len` calls on sequences in a boolean test context.
1413
///
1514
/// ## Why is this bad?
1615
/// Empty sequences are considered false in a boolean context.
17-
/// You can either remove the call to 'len'
16+
/// You can either remove the call to `len`
1817
/// or compare the length against a scalar.
1918
///
2019
/// ## Example

0 commit comments

Comments
 (0)