Skip to content

Commit 1602df1

Browse files
authored
Fix message for __aenter__ in PLC2801 (#9492)
<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary Fix the message for `__aenter__ ` in PLC2801 (introduced in #9166) There is no `aenter` builtin in Python, so the current message is misleading. I take the message from original lint https://github.com/pylint-dev/pylint/blob/main/pylint/constants.py#L211 P.S. I think here should be more accurate synchronization with original lint (e.g. the current implementation will not lint `__enter__` on my first sight), but it is out-of-scope of this change. <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan <!-- How was it tested? -->
1 parent 395cdf0 commit 1602df1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl DunderReplacement {
273273
"__str__" => Some(Self::Builtin("str", "Use `str()` builtin")),
274274
"__subclasscheck__" => Some(Self::Builtin("issubclass", "Use `issubclass()` builtin")),
275275

276-
"__aenter__" => Some(Self::MessageOnly("Use `aenter()` builtin")),
276+
"__aenter__" => Some(Self::MessageOnly("Invoke context manager directly")),
277277
"__ceil__" => Some(Self::MessageOnly("Use `math.ceil()` function")),
278278
"__copy__" => Some(Self::MessageOnly("Use `copy.copy()` function")),
279279
"__deepcopy__" => Some(Self::MessageOnly("Use `copy.deepcopy()` function")),

0 commit comments

Comments
 (0)