Closed
Description
opened on Dec 28, 2024
from pathlib import Path
# Before:
_ = Path(".",)
# ^^^ PTH201
# After:
_ = Path(,)
This happens because the fix is a simple range deletion:
let [Expr::StringLiteral(ast::ExprStringLiteral { value, range })] = &*arguments.args else {
return;
};
if matches!(value.to_str(), "" | ".") {
let mut diagnostic = Diagnostic::new(PathConstructorCurrentDirectory, *range);
diagnostic.set_fix(Fix::safe_edit(Edit::range_deletion(*range)));
checker.diagnostics.push(diagnostic);
}
Perhaps it should instead replace arguments.range
with ()
?
Activity