-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcome
Description
ARG002 is usually not raised in methods that immediately raise a NotImplementedError, but does if there is some other code in the method. However, EM101 enforces adding the error message into a separate variable, which is then seen as "code".
The result of this is that there is no way to write such a method without raising one or the other issue. See example below.
class EM101_found:
def test_method(self, **kwargs):
raise NotImplementedError("error message.")
class ARG002_found:
def test_method(self, **kwargs):
msg = "error message"
raise NotImplementedError(msg)running ruff check test_file.py --select ARG002 --select EM101 on the code snippet above results in
test_file.py:3:35: EM101 Exception must not use a string literal, assign to variable first
test_file.py:7:29: ARG002 Unused method argument:kwargs
Found 2 errors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcome