mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
[flake8-simplify
] Implementation for split-of-static-string
(SIM905) (#14008)
## Summary Closes https://github.com/astral-sh/ruff/issues/13944 ## Test Plan Standard snapshot testing flake8-simplify surprisingly only has a single test case --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
parent
0925513529
commit
f8374280c0
9 changed files with 1185 additions and 5 deletions
99
crates/ruff_linter/resources/test/fixtures/flake8_simplify/SIM905.py
vendored
Normal file
99
crates/ruff_linter/resources/test/fixtures/flake8_simplify/SIM905.py
vendored
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
# setup
|
||||||
|
sep = ","
|
||||||
|
no_sep = None
|
||||||
|
|
||||||
|
# positives
|
||||||
|
"""
|
||||||
|
itemA
|
||||||
|
itemB
|
||||||
|
itemC
|
||||||
|
""".split()
|
||||||
|
|
||||||
|
"a,b,c,d".split(",")
|
||||||
|
"a,b,c,d".split(None)
|
||||||
|
"a,b,c,d".split(",", 1)
|
||||||
|
"a,b,c,d".split(None, 1)
|
||||||
|
"a,b,c,d".split(sep=",")
|
||||||
|
"a,b,c,d".split(sep=None)
|
||||||
|
"a,b,c,d".split(sep=",", maxsplit=1)
|
||||||
|
"a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
"a,b,c,d".split(maxsplit=1, sep=",")
|
||||||
|
"a,b,c,d".split(maxsplit=1, sep=None)
|
||||||
|
"a,b,c,d".split(",", maxsplit=1)
|
||||||
|
"a,b,c,d".split(None, maxsplit=1)
|
||||||
|
"a,b,c,d".split(maxsplit=1)
|
||||||
|
"a,b,c,d".split(maxsplit=1.0)
|
||||||
|
"a,b,c,d".split(maxsplit=1)
|
||||||
|
"a,b,c,d".split(maxsplit=0)
|
||||||
|
"VERB AUX PRON ADP DET".split(" ")
|
||||||
|
' 1 2 3 '.split()
|
||||||
|
'1<>2<>3<4'.split('<>')
|
||||||
|
|
||||||
|
" a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a ']
|
||||||
|
"".split() # []
|
||||||
|
"""
|
||||||
|
""".split() # []
|
||||||
|
" ".split() # []
|
||||||
|
"/abc/".split() # ['/abc/']
|
||||||
|
("a,b,c"
|
||||||
|
# comment
|
||||||
|
.split()
|
||||||
|
) # ['a,b,c']
|
||||||
|
("a,b,c"
|
||||||
|
# comment1
|
||||||
|
.split(",")
|
||||||
|
) # ['a', 'b', 'c']
|
||||||
|
("a,"
|
||||||
|
# comment
|
||||||
|
"b,"
|
||||||
|
"c"
|
||||||
|
.split(",")
|
||||||
|
) # ['a', 'b', 'c']
|
||||||
|
|
||||||
|
"hello "\
|
||||||
|
"world".split()
|
||||||
|
# ['hello', 'world']
|
||||||
|
|
||||||
|
# prefixes and isc
|
||||||
|
u"a b".split() # ['a', 'b']
|
||||||
|
r"a \n b".split() # ['a', '\\n', 'b']
|
||||||
|
("a " "b").split() # ['a', 'b']
|
||||||
|
"a " "b".split() # ['a', 'b']
|
||||||
|
u"a " "b".split() # ['a', 'b']
|
||||||
|
"a " u"b".split() # ['a', 'b']
|
||||||
|
u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
r"\n " u"\n".split() # ['\\n']
|
||||||
|
r"\n " "\n".split() # ['\\n']
|
||||||
|
"a " r"\n".split() # ['a', '\\n']
|
||||||
|
|
||||||
|
"a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
"a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c']
|
||||||
|
"a,b,c".split(',', maxsplit=-2) # ['a', 'b', 'c']
|
||||||
|
"a,b,c".split(',', maxsplit=-0) # ['a,b,c']
|
||||||
|
|
||||||
|
# negatives
|
||||||
|
|
||||||
|
# invalid values should not cause panic
|
||||||
|
"a,b,c,d".split(maxsplit="hello")
|
||||||
|
"a,b,c,d".split(maxsplit=-"hello")
|
||||||
|
|
||||||
|
# variable names not implemented
|
||||||
|
"a,b,c,d".split(sep)
|
||||||
|
"a,b,c,d".split(no_sep)
|
||||||
|
for n in range(3):
|
||||||
|
"a,b,c,d".split(",", maxsplit=n)
|
||||||
|
|
||||||
|
# f-strings not yet implemented
|
||||||
|
world = "world"
|
||||||
|
_ = f"{world}_hello_world".split("_")
|
||||||
|
|
||||||
|
hello = "hello_world"
|
||||||
|
_ = f"{hello}_world".split("_")
|
||||||
|
|
||||||
|
# split on bytes not yet implemented, much less frequent
|
||||||
|
b"TesT.WwW.ExamplE.CoM".split(b".")
|
||||||
|
|
||||||
|
# str.splitlines not yet implemented
|
||||||
|
"hello\nworld".splitlines()
|
||||||
|
"hello\nworld".splitlines(keepends=True)
|
||||||
|
"hello\nworld".splitlines(keepends=False)
|
|
@ -388,6 +388,8 @@ pub(crate) fn expression(expr: &Expr, checker: &mut Checker) {
|
||||||
Rule::StaticJoinToFString,
|
Rule::StaticJoinToFString,
|
||||||
// refurb
|
// refurb
|
||||||
Rule::HashlibDigestHex,
|
Rule::HashlibDigestHex,
|
||||||
|
// flake8-simplify
|
||||||
|
Rule::SplitStaticString,
|
||||||
]) {
|
]) {
|
||||||
if let Expr::Attribute(ast::ExprAttribute { value, attr, .. }) = func.as_ref() {
|
if let Expr::Attribute(ast::ExprAttribute { value, attr, .. }) = func.as_ref() {
|
||||||
let attr = attr.as_str();
|
let attr = attr.as_str();
|
||||||
|
@ -405,6 +407,16 @@ pub(crate) fn expression(expr: &Expr, checker: &mut Checker) {
|
||||||
string_value.to_str(),
|
string_value.to_str(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else if matches!(attr, "split" | "rsplit") {
|
||||||
|
// "...".split(...) call
|
||||||
|
if checker.enabled(Rule::SplitStaticString) {
|
||||||
|
flake8_simplify::rules::split_static_string(
|
||||||
|
checker,
|
||||||
|
attr,
|
||||||
|
call,
|
||||||
|
string_value.to_str(),
|
||||||
|
);
|
||||||
|
}
|
||||||
} else if attr == "format" {
|
} else if attr == "format" {
|
||||||
// "...".format(...) call
|
// "...".format(...) call
|
||||||
let location = expr.range();
|
let location = expr.range();
|
||||||
|
|
|
@ -480,6 +480,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
||||||
(Flake8Simplify, "223") => (RuleGroup::Stable, rules::flake8_simplify::rules::ExprAndFalse),
|
(Flake8Simplify, "223") => (RuleGroup::Stable, rules::flake8_simplify::rules::ExprAndFalse),
|
||||||
(Flake8Simplify, "300") => (RuleGroup::Stable, rules::flake8_simplify::rules::YodaConditions),
|
(Flake8Simplify, "300") => (RuleGroup::Stable, rules::flake8_simplify::rules::YodaConditions),
|
||||||
(Flake8Simplify, "401") => (RuleGroup::Stable, rules::flake8_simplify::rules::IfElseBlockInsteadOfDictGet),
|
(Flake8Simplify, "401") => (RuleGroup::Stable, rules::flake8_simplify::rules::IfElseBlockInsteadOfDictGet),
|
||||||
|
(Flake8Simplify, "905") => (RuleGroup::Preview, rules::flake8_simplify::rules::SplitStaticString),
|
||||||
(Flake8Simplify, "910") => (RuleGroup::Stable, rules::flake8_simplify::rules::DictGetWithNoneDefault),
|
(Flake8Simplify, "910") => (RuleGroup::Stable, rules::flake8_simplify::rules::DictGetWithNoneDefault),
|
||||||
(Flake8Simplify, "911") => (RuleGroup::Stable, rules::flake8_simplify::rules::ZipDictKeysAndValues),
|
(Flake8Simplify, "911") => (RuleGroup::Stable, rules::flake8_simplify::rules::ZipDictKeysAndValues),
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,9 @@ mod tests {
|
||||||
#[test_case(Rule::ReimplementedBuiltin, Path::new("SIM111.py"))]
|
#[test_case(Rule::ReimplementedBuiltin, Path::new("SIM111.py"))]
|
||||||
#[test_case(Rule::UncapitalizedEnvironmentVariables, Path::new("SIM112.py"))]
|
#[test_case(Rule::UncapitalizedEnvironmentVariables, Path::new("SIM112.py"))]
|
||||||
#[test_case(Rule::EnumerateForLoop, Path::new("SIM113.py"))]
|
#[test_case(Rule::EnumerateForLoop, Path::new("SIM113.py"))]
|
||||||
|
#[test_case(Rule::IfWithSameArms, Path::new("SIM114.py"))]
|
||||||
#[test_case(Rule::OpenFileWithContextHandler, Path::new("SIM115.py"))]
|
#[test_case(Rule::OpenFileWithContextHandler, Path::new("SIM115.py"))]
|
||||||
|
#[test_case(Rule::IfElseBlockInsteadOfDictLookup, Path::new("SIM116.py"))]
|
||||||
#[test_case(Rule::MultipleWithStatements, Path::new("SIM117.py"))]
|
#[test_case(Rule::MultipleWithStatements, Path::new("SIM117.py"))]
|
||||||
#[test_case(Rule::InDictKeys, Path::new("SIM118.py"))]
|
#[test_case(Rule::InDictKeys, Path::new("SIM118.py"))]
|
||||||
#[test_case(Rule::NegateEqualOp, Path::new("SIM201.py"))]
|
#[test_case(Rule::NegateEqualOp, Path::new("SIM201.py"))]
|
||||||
|
@ -44,9 +46,8 @@ mod tests {
|
||||||
#[test_case(Rule::ExprAndFalse, Path::new("SIM223.py"))]
|
#[test_case(Rule::ExprAndFalse, Path::new("SIM223.py"))]
|
||||||
#[test_case(Rule::YodaConditions, Path::new("SIM300.py"))]
|
#[test_case(Rule::YodaConditions, Path::new("SIM300.py"))]
|
||||||
#[test_case(Rule::IfElseBlockInsteadOfDictGet, Path::new("SIM401.py"))]
|
#[test_case(Rule::IfElseBlockInsteadOfDictGet, Path::new("SIM401.py"))]
|
||||||
|
#[test_case(Rule::SplitStaticString, Path::new("SIM905.py"))]
|
||||||
#[test_case(Rule::DictGetWithNoneDefault, Path::new("SIM910.py"))]
|
#[test_case(Rule::DictGetWithNoneDefault, Path::new("SIM910.py"))]
|
||||||
#[test_case(Rule::IfElseBlockInsteadOfDictLookup, Path::new("SIM116.py"))]
|
|
||||||
#[test_case(Rule::IfWithSameArms, Path::new("SIM114.py"))]
|
|
||||||
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
|
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
|
||||||
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
|
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
|
||||||
let diagnostics = test_path(
|
let diagnostics = test_path(
|
||||||
|
|
|
@ -14,6 +14,7 @@ pub(crate) use needless_bool::*;
|
||||||
pub(crate) use open_file_with_context_handler::*;
|
pub(crate) use open_file_with_context_handler::*;
|
||||||
pub(crate) use reimplemented_builtin::*;
|
pub(crate) use reimplemented_builtin::*;
|
||||||
pub(crate) use return_in_try_except_finally::*;
|
pub(crate) use return_in_try_except_finally::*;
|
||||||
|
pub(crate) use split_static_string::*;
|
||||||
pub(crate) use suppressible_exception::*;
|
pub(crate) use suppressible_exception::*;
|
||||||
pub(crate) use yoda_conditions::*;
|
pub(crate) use yoda_conditions::*;
|
||||||
pub(crate) use zip_dict_keys_and_values::*;
|
pub(crate) use zip_dict_keys_and_values::*;
|
||||||
|
@ -35,6 +36,7 @@ mod needless_bool;
|
||||||
mod open_file_with_context_handler;
|
mod open_file_with_context_handler;
|
||||||
mod reimplemented_builtin;
|
mod reimplemented_builtin;
|
||||||
mod return_in_try_except_finally;
|
mod return_in_try_except_finally;
|
||||||
|
mod split_static_string;
|
||||||
mod suppressible_exception;
|
mod suppressible_exception;
|
||||||
mod yoda_conditions;
|
mod yoda_conditions;
|
||||||
mod zip_dict_keys_and_values;
|
mod zip_dict_keys_and_values;
|
||||||
|
|
|
@ -0,0 +1,219 @@
|
||||||
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
|
use ruff_diagnostics::{Applicability, Diagnostic, Edit, Fix, FixAvailability, Violation};
|
||||||
|
use ruff_macros::{derive_message_formats, violation};
|
||||||
|
use ruff_python_ast::{
|
||||||
|
Expr, ExprCall, ExprContext, ExprList, ExprStringLiteral, ExprUnaryOp, StringLiteral,
|
||||||
|
StringLiteralFlags, StringLiteralValue, UnaryOp,
|
||||||
|
};
|
||||||
|
use ruff_text_size::{Ranged, TextRange};
|
||||||
|
|
||||||
|
use crate::checkers::ast::Checker;
|
||||||
|
|
||||||
|
/// ## What it does
|
||||||
|
/// Checks for static `str.split` calls that can be replaced with list literals.
|
||||||
|
///
|
||||||
|
/// ## Why is this bad?
|
||||||
|
/// List literals are more readable and do not require the overhead of calling `str.split`.
|
||||||
|
///
|
||||||
|
/// ## Example
|
||||||
|
/// ```python
|
||||||
|
/// "a,b,c,d".split(",")
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// Use instead:
|
||||||
|
/// ```python
|
||||||
|
/// ["a", "b", "c", "d"]
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## Fix safety
|
||||||
|
/// This rule's fix is marked as unsafe for implicit string concatenations with comments interleaved
|
||||||
|
/// between segments, as comments may be removed.
|
||||||
|
///
|
||||||
|
/// For example, the fix would be marked as unsafe in the following case:
|
||||||
|
/// ```python
|
||||||
|
/// (
|
||||||
|
/// "a" # comment
|
||||||
|
/// "," # comment
|
||||||
|
/// "b" # comment
|
||||||
|
/// ).split(",")
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## References
|
||||||
|
/// - [Python documentation: `str.split`](https://docs.python.org/3/library/stdtypes.html#str.split)
|
||||||
|
/// ```
|
||||||
|
#[violation]
|
||||||
|
pub struct SplitStaticString;
|
||||||
|
|
||||||
|
impl Violation for SplitStaticString {
|
||||||
|
const FIX_AVAILABILITY: FixAvailability = FixAvailability::Sometimes;
|
||||||
|
|
||||||
|
#[derive_message_formats]
|
||||||
|
fn message(&self) -> String {
|
||||||
|
format!("Consider using a list literal instead of `str.split`")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn fix_title(&self) -> Option<String> {
|
||||||
|
Some("Replace with list literal".to_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// SIM905
|
||||||
|
pub(crate) fn split_static_string(
|
||||||
|
checker: &mut Checker,
|
||||||
|
attr: &str,
|
||||||
|
call: &ExprCall,
|
||||||
|
str_value: &str,
|
||||||
|
) {
|
||||||
|
let ExprCall { arguments, .. } = call;
|
||||||
|
|
||||||
|
let maxsplit_arg = arguments.find_argument("maxsplit", 1);
|
||||||
|
let Some(maxsplit_value) = get_maxsplit_value(maxsplit_arg) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
// `split` vs `rsplit`.
|
||||||
|
let direction = if attr == "split" {
|
||||||
|
Direction::Left
|
||||||
|
} else {
|
||||||
|
Direction::Right
|
||||||
|
};
|
||||||
|
|
||||||
|
let sep_arg = arguments.find_argument("sep", 0);
|
||||||
|
let split_replacement = if let Some(sep) = sep_arg {
|
||||||
|
match sep {
|
||||||
|
Expr::NoneLiteral(_) => split_default(str_value, maxsplit_value),
|
||||||
|
Expr::StringLiteral(sep_value) => {
|
||||||
|
let sep_value_str = sep_value.value.to_str();
|
||||||
|
Some(split_sep(
|
||||||
|
str_value,
|
||||||
|
sep_value_str,
|
||||||
|
maxsplit_value,
|
||||||
|
direction,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
// Ignore names until type inference is available.
|
||||||
|
_ => {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
split_default(str_value, maxsplit_value)
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut diagnostic = Diagnostic::new(SplitStaticString, call.range());
|
||||||
|
if let Some(ref replacement_expr) = split_replacement {
|
||||||
|
diagnostic.set_fix(Fix::applicable_edit(
|
||||||
|
Edit::range_replacement(checker.generator().expr(replacement_expr), call.range()),
|
||||||
|
// The fix does not preserve comments within implicit string concatenations.
|
||||||
|
if checker.comment_ranges().intersects(call.range()) {
|
||||||
|
Applicability::Unsafe
|
||||||
|
} else {
|
||||||
|
Applicability::Safe
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
checker.diagnostics.push(diagnostic);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn construct_replacement(elts: &[&str]) -> Expr {
|
||||||
|
Expr::List(ExprList {
|
||||||
|
elts: elts
|
||||||
|
.iter()
|
||||||
|
.map(|elt| {
|
||||||
|
Expr::StringLiteral(ExprStringLiteral {
|
||||||
|
value: StringLiteralValue::single(StringLiteral {
|
||||||
|
value: (*elt).to_string().into_boxed_str(),
|
||||||
|
range: TextRange::default(),
|
||||||
|
flags: StringLiteralFlags::default(),
|
||||||
|
}),
|
||||||
|
range: TextRange::default(),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
|
ctx: ExprContext::Load,
|
||||||
|
range: TextRange::default(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn split_default(str_value: &str, max_split: i32) -> Option<Expr> {
|
||||||
|
// From the Python documentation:
|
||||||
|
// > If sep is not specified or is None, a different splitting algorithm is applied: runs of
|
||||||
|
// > consecutive whitespace are regarded as a single separator, and the result will contain
|
||||||
|
// > no empty strings at the start or end if the string has leading or trailing whitespace.
|
||||||
|
// > Consequently, splitting an empty string or a string consisting of just whitespace with
|
||||||
|
// > a None separator returns [].
|
||||||
|
// https://docs.python.org/3/library/stdtypes.html#str.split
|
||||||
|
match max_split.cmp(&0) {
|
||||||
|
Ordering::Greater => {
|
||||||
|
// Autofix for `maxsplit` without separator not yet implemented, as
|
||||||
|
// `split_whitespace().remainder()` is not stable:
|
||||||
|
// https://doc.rust-lang.org/std/str/struct.SplitWhitespace.html#method.remainder
|
||||||
|
None
|
||||||
|
}
|
||||||
|
Ordering::Equal => {
|
||||||
|
let list_items: Vec<&str> = vec![str_value];
|
||||||
|
Some(construct_replacement(&list_items))
|
||||||
|
}
|
||||||
|
Ordering::Less => {
|
||||||
|
let list_items: Vec<&str> = str_value.split_whitespace().collect();
|
||||||
|
Some(construct_replacement(&list_items))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn split_sep(str_value: &str, sep_value: &str, max_split: i32, direction: Direction) -> Expr {
|
||||||
|
let list_items: Vec<&str> = if let Ok(split_n) = usize::try_from(max_split) {
|
||||||
|
match direction {
|
||||||
|
Direction::Left => str_value.splitn(split_n + 1, sep_value).collect(),
|
||||||
|
Direction::Right => str_value.rsplitn(split_n + 1, sep_value).collect(),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
match direction {
|
||||||
|
Direction::Left => str_value.split(sep_value).collect(),
|
||||||
|
Direction::Right => str_value.rsplit(sep_value).collect(),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
construct_replacement(&list_items)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the value of the `maxsplit` argument as an `i32`, if it is a numeric value.
|
||||||
|
fn get_maxsplit_value(arg: Option<&Expr>) -> Option<i32> {
|
||||||
|
if let Some(maxsplit) = arg {
|
||||||
|
match maxsplit {
|
||||||
|
// Negative number.
|
||||||
|
Expr::UnaryOp(ExprUnaryOp {
|
||||||
|
op: UnaryOp::USub,
|
||||||
|
operand,
|
||||||
|
..
|
||||||
|
}) => {
|
||||||
|
match &**operand {
|
||||||
|
Expr::NumberLiteral(maxsplit_val) => maxsplit_val
|
||||||
|
.value
|
||||||
|
.as_int()
|
||||||
|
.and_then(ruff_python_ast::Int::as_i32)
|
||||||
|
.map(|f| -f),
|
||||||
|
// Ignore when `maxsplit` is not a numeric value.
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Positive number
|
||||||
|
Expr::NumberLiteral(maxsplit_val) => maxsplit_val
|
||||||
|
.value
|
||||||
|
.as_int()
|
||||||
|
.and_then(ruff_python_ast::Int::as_i32),
|
||||||
|
// Ignore when `maxsplit` is not a numeric value.
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Default value is -1 (no splits).
|
||||||
|
Some(-1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
enum Direction {
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
}
|
|
@ -0,0 +1,845 @@
|
||||||
|
---
|
||||||
|
source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs
|
||||||
|
---
|
||||||
|
SIM905.py:6:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
5 | # positives
|
||||||
|
6 | / """
|
||||||
|
7 | | itemA
|
||||||
|
8 | | itemB
|
||||||
|
9 | | itemC
|
||||||
|
10 | | """.split()
|
||||||
|
| |___________^ SIM905
|
||||||
|
11 |
|
||||||
|
12 | "a,b,c,d".split(",")
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
3 3 | no_sep = None
|
||||||
|
4 4 |
|
||||||
|
5 5 | # positives
|
||||||
|
6 |-"""
|
||||||
|
7 |- itemA
|
||||||
|
8 |- itemB
|
||||||
|
9 |- itemC
|
||||||
|
10 |-""".split()
|
||||||
|
6 |+["itemA", "itemB", "itemC"]
|
||||||
|
11 7 |
|
||||||
|
12 8 | "a,b,c,d".split(",")
|
||||||
|
13 9 | "a,b,c,d".split(None)
|
||||||
|
|
||||||
|
SIM905.py:12:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
10 | """.split()
|
||||||
|
11 |
|
||||||
|
12 | "a,b,c,d".split(",")
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
13 | "a,b,c,d".split(None)
|
||||||
|
14 | "a,b,c,d".split(",", 1)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
9 9 | itemC
|
||||||
|
10 10 | """.split()
|
||||||
|
11 11 |
|
||||||
|
12 |-"a,b,c,d".split(",")
|
||||||
|
12 |+["a", "b", "c", "d"]
|
||||||
|
13 13 | "a,b,c,d".split(None)
|
||||||
|
14 14 | "a,b,c,d".split(",", 1)
|
||||||
|
15 15 | "a,b,c,d".split(None, 1)
|
||||||
|
|
||||||
|
SIM905.py:13:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
12 | "a,b,c,d".split(",")
|
||||||
|
13 | "a,b,c,d".split(None)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
14 | "a,b,c,d".split(",", 1)
|
||||||
|
15 | "a,b,c,d".split(None, 1)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
10 10 | """.split()
|
||||||
|
11 11 |
|
||||||
|
12 12 | "a,b,c,d".split(",")
|
||||||
|
13 |-"a,b,c,d".split(None)
|
||||||
|
13 |+["a,b,c,d"]
|
||||||
|
14 14 | "a,b,c,d".split(",", 1)
|
||||||
|
15 15 | "a,b,c,d".split(None, 1)
|
||||||
|
16 16 | "a,b,c,d".split(sep=",")
|
||||||
|
|
||||||
|
SIM905.py:14:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
12 | "a,b,c,d".split(",")
|
||||||
|
13 | "a,b,c,d".split(None)
|
||||||
|
14 | "a,b,c,d".split(",", 1)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
15 | "a,b,c,d".split(None, 1)
|
||||||
|
16 | "a,b,c,d".split(sep=",")
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
11 11 |
|
||||||
|
12 12 | "a,b,c,d".split(",")
|
||||||
|
13 13 | "a,b,c,d".split(None)
|
||||||
|
14 |-"a,b,c,d".split(",", 1)
|
||||||
|
14 |+["a", "b,c,d"]
|
||||||
|
15 15 | "a,b,c,d".split(None, 1)
|
||||||
|
16 16 | "a,b,c,d".split(sep=",")
|
||||||
|
17 17 | "a,b,c,d".split(sep=None)
|
||||||
|
|
||||||
|
SIM905.py:15:1: SIM905 Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
13 | "a,b,c,d".split(None)
|
||||||
|
14 | "a,b,c,d".split(",", 1)
|
||||||
|
15 | "a,b,c,d".split(None, 1)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
16 | "a,b,c,d".split(sep=",")
|
||||||
|
17 | "a,b,c,d".split(sep=None)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
SIM905.py:16:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
14 | "a,b,c,d".split(",", 1)
|
||||||
|
15 | "a,b,c,d".split(None, 1)
|
||||||
|
16 | "a,b,c,d".split(sep=",")
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
17 | "a,b,c,d".split(sep=None)
|
||||||
|
18 | "a,b,c,d".split(sep=",", maxsplit=1)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
13 13 | "a,b,c,d".split(None)
|
||||||
|
14 14 | "a,b,c,d".split(",", 1)
|
||||||
|
15 15 | "a,b,c,d".split(None, 1)
|
||||||
|
16 |-"a,b,c,d".split(sep=",")
|
||||||
|
16 |+["a", "b", "c", "d"]
|
||||||
|
17 17 | "a,b,c,d".split(sep=None)
|
||||||
|
18 18 | "a,b,c,d".split(sep=",", maxsplit=1)
|
||||||
|
19 19 | "a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
|
||||||
|
SIM905.py:17:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
15 | "a,b,c,d".split(None, 1)
|
||||||
|
16 | "a,b,c,d".split(sep=",")
|
||||||
|
17 | "a,b,c,d".split(sep=None)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
18 | "a,b,c,d".split(sep=",", maxsplit=1)
|
||||||
|
19 | "a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
14 14 | "a,b,c,d".split(",", 1)
|
||||||
|
15 15 | "a,b,c,d".split(None, 1)
|
||||||
|
16 16 | "a,b,c,d".split(sep=",")
|
||||||
|
17 |-"a,b,c,d".split(sep=None)
|
||||||
|
17 |+["a,b,c,d"]
|
||||||
|
18 18 | "a,b,c,d".split(sep=",", maxsplit=1)
|
||||||
|
19 19 | "a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
20 20 | "a,b,c,d".split(maxsplit=1, sep=",")
|
||||||
|
|
||||||
|
SIM905.py:18:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
16 | "a,b,c,d".split(sep=",")
|
||||||
|
17 | "a,b,c,d".split(sep=None)
|
||||||
|
18 | "a,b,c,d".split(sep=",", maxsplit=1)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
19 | "a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
20 | "a,b,c,d".split(maxsplit=1, sep=",")
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
15 15 | "a,b,c,d".split(None, 1)
|
||||||
|
16 16 | "a,b,c,d".split(sep=",")
|
||||||
|
17 17 | "a,b,c,d".split(sep=None)
|
||||||
|
18 |-"a,b,c,d".split(sep=",", maxsplit=1)
|
||||||
|
18 |+["a", "b,c,d"]
|
||||||
|
19 19 | "a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
20 20 | "a,b,c,d".split(maxsplit=1, sep=",")
|
||||||
|
21 21 | "a,b,c,d".split(maxsplit=1, sep=None)
|
||||||
|
|
||||||
|
SIM905.py:19:1: SIM905 Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
17 | "a,b,c,d".split(sep=None)
|
||||||
|
18 | "a,b,c,d".split(sep=",", maxsplit=1)
|
||||||
|
19 | "a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
20 | "a,b,c,d".split(maxsplit=1, sep=",")
|
||||||
|
21 | "a,b,c,d".split(maxsplit=1, sep=None)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
SIM905.py:20:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
18 | "a,b,c,d".split(sep=",", maxsplit=1)
|
||||||
|
19 | "a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
20 | "a,b,c,d".split(maxsplit=1, sep=",")
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
21 | "a,b,c,d".split(maxsplit=1, sep=None)
|
||||||
|
22 | "a,b,c,d".split(",", maxsplit=1)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
17 17 | "a,b,c,d".split(sep=None)
|
||||||
|
18 18 | "a,b,c,d".split(sep=",", maxsplit=1)
|
||||||
|
19 19 | "a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
20 |-"a,b,c,d".split(maxsplit=1, sep=",")
|
||||||
|
20 |+["a", "b,c,d"]
|
||||||
|
21 21 | "a,b,c,d".split(maxsplit=1, sep=None)
|
||||||
|
22 22 | "a,b,c,d".split(",", maxsplit=1)
|
||||||
|
23 23 | "a,b,c,d".split(None, maxsplit=1)
|
||||||
|
|
||||||
|
SIM905.py:21:1: SIM905 Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
19 | "a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
20 | "a,b,c,d".split(maxsplit=1, sep=",")
|
||||||
|
21 | "a,b,c,d".split(maxsplit=1, sep=None)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
22 | "a,b,c,d".split(",", maxsplit=1)
|
||||||
|
23 | "a,b,c,d".split(None, maxsplit=1)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
SIM905.py:22:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
20 | "a,b,c,d".split(maxsplit=1, sep=",")
|
||||||
|
21 | "a,b,c,d".split(maxsplit=1, sep=None)
|
||||||
|
22 | "a,b,c,d".split(",", maxsplit=1)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
23 | "a,b,c,d".split(None, maxsplit=1)
|
||||||
|
24 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
19 19 | "a,b,c,d".split(sep=None, maxsplit=1)
|
||||||
|
20 20 | "a,b,c,d".split(maxsplit=1, sep=",")
|
||||||
|
21 21 | "a,b,c,d".split(maxsplit=1, sep=None)
|
||||||
|
22 |-"a,b,c,d".split(",", maxsplit=1)
|
||||||
|
22 |+["a", "b,c,d"]
|
||||||
|
23 23 | "a,b,c,d".split(None, maxsplit=1)
|
||||||
|
24 24 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
25 25 | "a,b,c,d".split(maxsplit=1.0)
|
||||||
|
|
||||||
|
SIM905.py:23:1: SIM905 Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
21 | "a,b,c,d".split(maxsplit=1, sep=None)
|
||||||
|
22 | "a,b,c,d".split(",", maxsplit=1)
|
||||||
|
23 | "a,b,c,d".split(None, maxsplit=1)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
24 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
25 | "a,b,c,d".split(maxsplit=1.0)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
SIM905.py:24:1: SIM905 Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
22 | "a,b,c,d".split(",", maxsplit=1)
|
||||||
|
23 | "a,b,c,d".split(None, maxsplit=1)
|
||||||
|
24 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
25 | "a,b,c,d".split(maxsplit=1.0)
|
||||||
|
26 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
SIM905.py:26:1: SIM905 Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
24 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
25 | "a,b,c,d".split(maxsplit=1.0)
|
||||||
|
26 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
27 | "a,b,c,d".split(maxsplit=0)
|
||||||
|
28 | "VERB AUX PRON ADP DET".split(" ")
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
SIM905.py:27:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
25 | "a,b,c,d".split(maxsplit=1.0)
|
||||||
|
26 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
27 | "a,b,c,d".split(maxsplit=0)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
28 | "VERB AUX PRON ADP DET".split(" ")
|
||||||
|
29 | ' 1 2 3 '.split()
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
24 24 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
25 25 | "a,b,c,d".split(maxsplit=1.0)
|
||||||
|
26 26 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
27 |-"a,b,c,d".split(maxsplit=0)
|
||||||
|
27 |+["a,b,c,d"]
|
||||||
|
28 28 | "VERB AUX PRON ADP DET".split(" ")
|
||||||
|
29 29 | ' 1 2 3 '.split()
|
||||||
|
30 30 | '1<>2<>3<4'.split('<>')
|
||||||
|
|
||||||
|
SIM905.py:28:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
26 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
27 | "a,b,c,d".split(maxsplit=0)
|
||||||
|
28 | "VERB AUX PRON ADP DET".split(" ")
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
29 | ' 1 2 3 '.split()
|
||||||
|
30 | '1<>2<>3<4'.split('<>')
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
25 25 | "a,b,c,d".split(maxsplit=1.0)
|
||||||
|
26 26 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
27 27 | "a,b,c,d".split(maxsplit=0)
|
||||||
|
28 |-"VERB AUX PRON ADP DET".split(" ")
|
||||||
|
28 |+["VERB", "AUX", "PRON", "ADP", "DET"]
|
||||||
|
29 29 | ' 1 2 3 '.split()
|
||||||
|
30 30 | '1<>2<>3<4'.split('<>')
|
||||||
|
31 31 |
|
||||||
|
|
||||||
|
SIM905.py:29:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
27 | "a,b,c,d".split(maxsplit=0)
|
||||||
|
28 | "VERB AUX PRON ADP DET".split(" ")
|
||||||
|
29 | ' 1 2 3 '.split()
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
30 | '1<>2<>3<4'.split('<>')
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
26 26 | "a,b,c,d".split(maxsplit=1)
|
||||||
|
27 27 | "a,b,c,d".split(maxsplit=0)
|
||||||
|
28 28 | "VERB AUX PRON ADP DET".split(" ")
|
||||||
|
29 |-' 1 2 3 '.split()
|
||||||
|
29 |+["1", "2", "3"]
|
||||||
|
30 30 | '1<>2<>3<4'.split('<>')
|
||||||
|
31 31 |
|
||||||
|
32 32 | " a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a ']
|
||||||
|
|
||||||
|
SIM905.py:30:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
28 | "VERB AUX PRON ADP DET".split(" ")
|
||||||
|
29 | ' 1 2 3 '.split()
|
||||||
|
30 | '1<>2<>3<4'.split('<>')
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
31 |
|
||||||
|
32 | " a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a ']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
27 27 | "a,b,c,d".split(maxsplit=0)
|
||||||
|
28 28 | "VERB AUX PRON ADP DET".split(" ")
|
||||||
|
29 29 | ' 1 2 3 '.split()
|
||||||
|
30 |-'1<>2<>3<4'.split('<>')
|
||||||
|
30 |+["1", "2", "3<4"]
|
||||||
|
31 31 |
|
||||||
|
32 32 | " a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a ']
|
||||||
|
33 33 | "".split() # []
|
||||||
|
|
||||||
|
SIM905.py:32:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
30 | '1<>2<>3<4'.split('<>')
|
||||||
|
31 |
|
||||||
|
32 | " a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a ']
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
33 | "".split() # []
|
||||||
|
34 | """
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
29 29 | ' 1 2 3 '.split()
|
||||||
|
30 30 | '1<>2<>3<4'.split('<>')
|
||||||
|
31 31 |
|
||||||
|
32 |-" a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a ']
|
||||||
|
32 |+[" a", "a a", "a a "] # [' a', 'a a', 'a a ']
|
||||||
|
33 33 | "".split() # []
|
||||||
|
34 34 | """
|
||||||
|
35 35 | """.split() # []
|
||||||
|
|
||||||
|
SIM905.py:33:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
32 | " a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a ']
|
||||||
|
33 | "".split() # []
|
||||||
|
| ^^^^^^^^^^ SIM905
|
||||||
|
34 | """
|
||||||
|
35 | """.split() # []
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
30 30 | '1<>2<>3<4'.split('<>')
|
||||||
|
31 31 |
|
||||||
|
32 32 | " a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a ']
|
||||||
|
33 |-"".split() # []
|
||||||
|
33 |+[] # []
|
||||||
|
34 34 | """
|
||||||
|
35 35 | """.split() # []
|
||||||
|
36 36 | " ".split() # []
|
||||||
|
|
||||||
|
SIM905.py:34:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
32 | " a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a ']
|
||||||
|
33 | "".split() # []
|
||||||
|
34 | / """
|
||||||
|
35 | | """.split() # []
|
||||||
|
| |___________^ SIM905
|
||||||
|
36 | " ".split() # []
|
||||||
|
37 | "/abc/".split() # ['/abc/']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
31 31 |
|
||||||
|
32 32 | " a*a a*a a ".split("*", -1) # [' a', 'a a', 'a a ']
|
||||||
|
33 33 | "".split() # []
|
||||||
|
34 |-"""
|
||||||
|
35 |-""".split() # []
|
||||||
|
34 |+[] # []
|
||||||
|
36 35 | " ".split() # []
|
||||||
|
37 36 | "/abc/".split() # ['/abc/']
|
||||||
|
38 37 | ("a,b,c"
|
||||||
|
|
||||||
|
SIM905.py:36:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
34 | """
|
||||||
|
35 | """.split() # []
|
||||||
|
36 | " ".split() # []
|
||||||
|
| ^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
37 | "/abc/".split() # ['/abc/']
|
||||||
|
38 | ("a,b,c"
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
33 33 | "".split() # []
|
||||||
|
34 34 | """
|
||||||
|
35 35 | """.split() # []
|
||||||
|
36 |-" ".split() # []
|
||||||
|
36 |+[] # []
|
||||||
|
37 37 | "/abc/".split() # ['/abc/']
|
||||||
|
38 38 | ("a,b,c"
|
||||||
|
39 39 | # comment
|
||||||
|
|
||||||
|
SIM905.py:37:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
35 | """.split() # []
|
||||||
|
36 | " ".split() # []
|
||||||
|
37 | "/abc/".split() # ['/abc/']
|
||||||
|
| ^^^^^^^^^^^^^^^ SIM905
|
||||||
|
38 | ("a,b,c"
|
||||||
|
39 | # comment
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
34 34 | """
|
||||||
|
35 35 | """.split() # []
|
||||||
|
36 36 | " ".split() # []
|
||||||
|
37 |-"/abc/".split() # ['/abc/']
|
||||||
|
37 |+["/abc/"] # ['/abc/']
|
||||||
|
38 38 | ("a,b,c"
|
||||||
|
39 39 | # comment
|
||||||
|
40 40 | .split()
|
||||||
|
|
||||||
|
SIM905.py:38:2: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
36 | " ".split() # []
|
||||||
|
37 | "/abc/".split() # ['/abc/']
|
||||||
|
38 | ("a,b,c"
|
||||||
|
| __^
|
||||||
|
39 | | # comment
|
||||||
|
40 | | .split()
|
||||||
|
| |________^ SIM905
|
||||||
|
41 | ) # ['a,b,c']
|
||||||
|
42 | ("a,b,c"
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Unsafe fix
|
||||||
|
35 35 | """.split() # []
|
||||||
|
36 36 | " ".split() # []
|
||||||
|
37 37 | "/abc/".split() # ['/abc/']
|
||||||
|
38 |-("a,b,c"
|
||||||
|
39 |-# comment
|
||||||
|
40 |-.split()
|
||||||
|
38 |+(["a,b,c"]
|
||||||
|
41 39 | ) # ['a,b,c']
|
||||||
|
42 40 | ("a,b,c"
|
||||||
|
43 41 | # comment1
|
||||||
|
|
||||||
|
SIM905.py:42:2: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
40 | .split()
|
||||||
|
41 | ) # ['a,b,c']
|
||||||
|
42 | ("a,b,c"
|
||||||
|
| __^
|
||||||
|
43 | | # comment1
|
||||||
|
44 | | .split(",")
|
||||||
|
| |___________^ SIM905
|
||||||
|
45 | ) # ['a', 'b', 'c']
|
||||||
|
46 | ("a,"
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Unsafe fix
|
||||||
|
39 39 | # comment
|
||||||
|
40 40 | .split()
|
||||||
|
41 41 | ) # ['a,b,c']
|
||||||
|
42 |-("a,b,c"
|
||||||
|
43 |-# comment1
|
||||||
|
44 |-.split(",")
|
||||||
|
42 |+(["a", "b", "c"]
|
||||||
|
45 43 | ) # ['a', 'b', 'c']
|
||||||
|
46 44 | ("a,"
|
||||||
|
47 45 | # comment
|
||||||
|
|
||||||
|
SIM905.py:46:2: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
44 | .split(",")
|
||||||
|
45 | ) # ['a', 'b', 'c']
|
||||||
|
46 | ("a,"
|
||||||
|
| __^
|
||||||
|
47 | | # comment
|
||||||
|
48 | | "b,"
|
||||||
|
49 | | "c"
|
||||||
|
50 | | .split(",")
|
||||||
|
| |___________^ SIM905
|
||||||
|
51 | ) # ['a', 'b', 'c']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Unsafe fix
|
||||||
|
43 43 | # comment1
|
||||||
|
44 44 | .split(",")
|
||||||
|
45 45 | ) # ['a', 'b', 'c']
|
||||||
|
46 |-("a,"
|
||||||
|
47 |-# comment
|
||||||
|
48 |-"b,"
|
||||||
|
49 |-"c"
|
||||||
|
50 |-.split(",")
|
||||||
|
46 |+(["a", "b", "c"]
|
||||||
|
51 47 | ) # ['a', 'b', 'c']
|
||||||
|
52 48 |
|
||||||
|
53 49 | "hello "\
|
||||||
|
|
||||||
|
SIM905.py:53:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
51 | ) # ['a', 'b', 'c']
|
||||||
|
52 |
|
||||||
|
53 | / "hello "\
|
||||||
|
54 | | "world".split()
|
||||||
|
| |___________________^ SIM905
|
||||||
|
55 | # ['hello', 'world']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
50 50 | .split(",")
|
||||||
|
51 51 | ) # ['a', 'b', 'c']
|
||||||
|
52 52 |
|
||||||
|
53 |-"hello "\
|
||||||
|
54 |- "world".split()
|
||||||
|
53 |+["hello", "world"]
|
||||||
|
55 54 | # ['hello', 'world']
|
||||||
|
56 55 |
|
||||||
|
57 56 | # prefixes and isc
|
||||||
|
|
||||||
|
SIM905.py:58:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
57 | # prefixes and isc
|
||||||
|
58 | u"a b".split() # ['a', 'b']
|
||||||
|
| ^^^^^^^^^^^^^^ SIM905
|
||||||
|
59 | r"a \n b".split() # ['a', '\\n', 'b']
|
||||||
|
60 | ("a " "b").split() # ['a', 'b']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
55 55 | # ['hello', 'world']
|
||||||
|
56 56 |
|
||||||
|
57 57 | # prefixes and isc
|
||||||
|
58 |-u"a b".split() # ['a', 'b']
|
||||||
|
58 |+["a", "b"] # ['a', 'b']
|
||||||
|
59 59 | r"a \n b".split() # ['a', '\\n', 'b']
|
||||||
|
60 60 | ("a " "b").split() # ['a', 'b']
|
||||||
|
61 61 | "a " "b".split() # ['a', 'b']
|
||||||
|
|
||||||
|
SIM905.py:59:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
57 | # prefixes and isc
|
||||||
|
58 | u"a b".split() # ['a', 'b']
|
||||||
|
59 | r"a \n b".split() # ['a', '\\n', 'b']
|
||||||
|
| ^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
60 | ("a " "b").split() # ['a', 'b']
|
||||||
|
61 | "a " "b".split() # ['a', 'b']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
56 56 |
|
||||||
|
57 57 | # prefixes and isc
|
||||||
|
58 58 | u"a b".split() # ['a', 'b']
|
||||||
|
59 |-r"a \n b".split() # ['a', '\\n', 'b']
|
||||||
|
59 |+["a", "\\n", "b"] # ['a', '\\n', 'b']
|
||||||
|
60 60 | ("a " "b").split() # ['a', 'b']
|
||||||
|
61 61 | "a " "b".split() # ['a', 'b']
|
||||||
|
62 62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
|
||||||
|
SIM905.py:60:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
58 | u"a b".split() # ['a', 'b']
|
||||||
|
59 | r"a \n b".split() # ['a', '\\n', 'b']
|
||||||
|
60 | ("a " "b").split() # ['a', 'b']
|
||||||
|
| ^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
61 | "a " "b".split() # ['a', 'b']
|
||||||
|
62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
57 57 | # prefixes and isc
|
||||||
|
58 58 | u"a b".split() # ['a', 'b']
|
||||||
|
59 59 | r"a \n b".split() # ['a', '\\n', 'b']
|
||||||
|
60 |-("a " "b").split() # ['a', 'b']
|
||||||
|
60 |+["a", "b"] # ['a', 'b']
|
||||||
|
61 61 | "a " "b".split() # ['a', 'b']
|
||||||
|
62 62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
63 63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
|
||||||
|
SIM905.py:61:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
59 | r"a \n b".split() # ['a', '\\n', 'b']
|
||||||
|
60 | ("a " "b").split() # ['a', 'b']
|
||||||
|
61 | "a " "b".split() # ['a', 'b']
|
||||||
|
| ^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
58 58 | u"a b".split() # ['a', 'b']
|
||||||
|
59 59 | r"a \n b".split() # ['a', '\\n', 'b']
|
||||||
|
60 60 | ("a " "b").split() # ['a', 'b']
|
||||||
|
61 |-"a " "b".split() # ['a', 'b']
|
||||||
|
61 |+["a", "b"] # ['a', 'b']
|
||||||
|
62 62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
63 63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
64 64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
|
||||||
|
SIM905.py:62:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
60 | ("a " "b").split() # ['a', 'b']
|
||||||
|
61 | "a " "b".split() # ['a', 'b']
|
||||||
|
62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
| ^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
59 59 | r"a \n b".split() # ['a', '\\n', 'b']
|
||||||
|
60 60 | ("a " "b").split() # ['a', 'b']
|
||||||
|
61 61 | "a " "b".split() # ['a', 'b']
|
||||||
|
62 |-u"a " "b".split() # ['a', 'b']
|
||||||
|
62 |+["a", "b"] # ['a', 'b']
|
||||||
|
63 63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
64 64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
65 65 | r"\n " u"\n".split() # ['\\n']
|
||||||
|
|
||||||
|
SIM905.py:63:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
61 | "a " "b".split() # ['a', 'b']
|
||||||
|
62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
| ^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
65 | r"\n " u"\n".split() # ['\\n']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
60 60 | ("a " "b").split() # ['a', 'b']
|
||||||
|
61 61 | "a " "b".split() # ['a', 'b']
|
||||||
|
62 62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
63 |-"a " u"b".split() # ['a', 'b']
|
||||||
|
63 |+["a", "b"] # ['a', 'b']
|
||||||
|
64 64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
65 65 | r"\n " u"\n".split() # ['\\n']
|
||||||
|
66 66 | r"\n " "\n".split() # ['\\n']
|
||||||
|
|
||||||
|
SIM905.py:64:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
65 | r"\n " u"\n".split() # ['\\n']
|
||||||
|
66 | r"\n " "\n".split() # ['\\n']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
61 61 | "a " "b".split() # ['a', 'b']
|
||||||
|
62 62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
63 63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
64 |-u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
64 |+["a", "\\n"] # ['a', '\\n']
|
||||||
|
65 65 | r"\n " u"\n".split() # ['\\n']
|
||||||
|
66 66 | r"\n " "\n".split() # ['\\n']
|
||||||
|
67 67 | "a " r"\n".split() # ['a', '\\n']
|
||||||
|
|
||||||
|
SIM905.py:65:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
65 | r"\n " u"\n".split() # ['\\n']
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
66 | r"\n " "\n".split() # ['\\n']
|
||||||
|
67 | "a " r"\n".split() # ['a', '\\n']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
62 62 | u"a " "b".split() # ['a', 'b']
|
||||||
|
63 63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
64 64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
65 |-r"\n " u"\n".split() # ['\\n']
|
||||||
|
65 |+["\\n"] # ['\\n']
|
||||||
|
66 66 | r"\n " "\n".split() # ['\\n']
|
||||||
|
67 67 | "a " r"\n".split() # ['a', '\\n']
|
||||||
|
68 68 |
|
||||||
|
|
||||||
|
SIM905.py:66:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
65 | r"\n " u"\n".split() # ['\\n']
|
||||||
|
66 | r"\n " "\n".split() # ['\\n']
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
67 | "a " r"\n".split() # ['a', '\\n']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
63 63 | "a " u"b".split() # ['a', 'b']
|
||||||
|
64 64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
65 65 | r"\n " u"\n".split() # ['\\n']
|
||||||
|
66 |-r"\n " "\n".split() # ['\\n']
|
||||||
|
66 |+["\\n"] # ['\\n']
|
||||||
|
67 67 | "a " r"\n".split() # ['a', '\\n']
|
||||||
|
68 68 |
|
||||||
|
69 69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
|
||||||
|
SIM905.py:67:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
65 | r"\n " u"\n".split() # ['\\n']
|
||||||
|
66 | r"\n " "\n".split() # ['\\n']
|
||||||
|
67 | "a " r"\n".split() # ['a', '\\n']
|
||||||
|
| ^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
68 |
|
||||||
|
69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
64 64 | u"a " r"\n".split() # ['a', '\\n']
|
||||||
|
65 65 | r"\n " u"\n".split() # ['\\n']
|
||||||
|
66 66 | r"\n " "\n".split() # ['\\n']
|
||||||
|
67 |-"a " r"\n".split() # ['a', '\\n']
|
||||||
|
67 |+["a", "\\n"] # ['a', '\\n']
|
||||||
|
68 68 |
|
||||||
|
69 69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
70 70 | "a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c']
|
||||||
|
|
||||||
|
SIM905.py:69:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
67 | "a " r"\n".split() # ['a', '\\n']
|
||||||
|
68 |
|
||||||
|
69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
70 | "a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c']
|
||||||
|
71 | "a,b,c".split(',', maxsplit=-2) # ['a', 'b', 'c']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
66 66 | r"\n " "\n".split() # ['\\n']
|
||||||
|
67 67 | "a " r"\n".split() # ['a', '\\n']
|
||||||
|
68 68 |
|
||||||
|
69 |-"a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
69 |+["a,b,c"] # ['a,b,c']
|
||||||
|
70 70 | "a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c']
|
||||||
|
71 71 | "a,b,c".split(',', maxsplit=-2) # ['a', 'b', 'c']
|
||||||
|
72 72 | "a,b,c".split(',', maxsplit=-0) # ['a,b,c']
|
||||||
|
|
||||||
|
SIM905.py:70:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
70 | "a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c']
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
71 | "a,b,c".split(',', maxsplit=-2) # ['a', 'b', 'c']
|
||||||
|
72 | "a,b,c".split(',', maxsplit=-0) # ['a,b,c']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
67 67 | "a " r"\n".split() # ['a', '\\n']
|
||||||
|
68 68 |
|
||||||
|
69 69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
70 |-"a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c']
|
||||||
|
70 |+["a", "b", "c"] # ['a', 'b', 'c']
|
||||||
|
71 71 | "a,b,c".split(',', maxsplit=-2) # ['a', 'b', 'c']
|
||||||
|
72 72 | "a,b,c".split(',', maxsplit=-0) # ['a,b,c']
|
||||||
|
73 73 |
|
||||||
|
|
||||||
|
SIM905.py:71:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
70 | "a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c']
|
||||||
|
71 | "a,b,c".split(',', maxsplit=-2) # ['a', 'b', 'c']
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
72 | "a,b,c".split(',', maxsplit=-0) # ['a,b,c']
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
68 68 |
|
||||||
|
69 69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
70 70 | "a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c']
|
||||||
|
71 |-"a,b,c".split(',', maxsplit=-2) # ['a', 'b', 'c']
|
||||||
|
71 |+["a", "b", "c"] # ['a', 'b', 'c']
|
||||||
|
72 72 | "a,b,c".split(',', maxsplit=-0) # ['a,b,c']
|
||||||
|
73 73 |
|
||||||
|
74 74 | # negatives
|
||||||
|
|
||||||
|
SIM905.py:72:1: SIM905 [*] Consider using a list literal instead of `str.split`
|
||||||
|
|
|
||||||
|
70 | "a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c']
|
||||||
|
71 | "a,b,c".split(',', maxsplit=-2) # ['a', 'b', 'c']
|
||||||
|
72 | "a,b,c".split(',', maxsplit=-0) # ['a,b,c']
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM905
|
||||||
|
73 |
|
||||||
|
74 | # negatives
|
||||||
|
|
|
||||||
|
= help: Replace with list literal
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
69 69 | "a,b,c".split(',', maxsplit=0) # ['a,b,c']
|
||||||
|
70 70 | "a,b,c".split(',', maxsplit=-1) # ['a', 'b', 'c']
|
||||||
|
71 71 | "a,b,c".split(',', maxsplit=-2) # ['a', 'b', 'c']
|
||||||
|
72 |-"a,b,c".split(',', maxsplit=-0) # ['a,b,c']
|
||||||
|
72 |+["a,b,c"] # ['a,b,c']
|
||||||
|
73 73 |
|
||||||
|
74 74 | # negatives
|
||||||
|
75 75 |
|
|
@ -18,6 +18,7 @@ pub(crate) use mutable_dataclass_default::*;
|
||||||
pub(crate) use mutable_fromkeys_value::*;
|
pub(crate) use mutable_fromkeys_value::*;
|
||||||
pub(crate) use never_union::*;
|
pub(crate) use never_union::*;
|
||||||
pub(crate) use parenthesize_logical_operators::*;
|
pub(crate) use parenthesize_logical_operators::*;
|
||||||
|
pub(crate) use post_init_default::*;
|
||||||
pub(crate) use quadratic_list_summation::*;
|
pub(crate) use quadratic_list_summation::*;
|
||||||
pub(crate) use redirected_noqa::*;
|
pub(crate) use redirected_noqa::*;
|
||||||
pub(crate) use sort_dunder_all::*;
|
pub(crate) use sort_dunder_all::*;
|
||||||
|
@ -54,6 +55,7 @@ mod mutable_dataclass_default;
|
||||||
mod mutable_fromkeys_value;
|
mod mutable_fromkeys_value;
|
||||||
mod never_union;
|
mod never_union;
|
||||||
mod parenthesize_logical_operators;
|
mod parenthesize_logical_operators;
|
||||||
|
mod post_init_default;
|
||||||
mod quadratic_list_summation;
|
mod quadratic_list_summation;
|
||||||
mod redirected_noqa;
|
mod redirected_noqa;
|
||||||
mod sequence_sorting;
|
mod sequence_sorting;
|
||||||
|
@ -76,6 +78,3 @@ pub(crate) enum Context {
|
||||||
Docstring,
|
Docstring,
|
||||||
Comment,
|
Comment,
|
||||||
}
|
}
|
||||||
pub(crate) use post_init_default::*;
|
|
||||||
|
|
||||||
mod post_init_default;
|
|
||||||
|
|
2
ruff.schema.json
generated
2
ruff.schema.json
generated
|
@ -3953,6 +3953,8 @@
|
||||||
"SIM40",
|
"SIM40",
|
||||||
"SIM401",
|
"SIM401",
|
||||||
"SIM9",
|
"SIM9",
|
||||||
|
"SIM90",
|
||||||
|
"SIM905",
|
||||||
"SIM91",
|
"SIM91",
|
||||||
"SIM910",
|
"SIM910",
|
||||||
"SIM911",
|
"SIM911",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue