Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule PLR6301 ignore comment requires odd location #8635

Closed
ofek opened this issue Nov 12, 2023 · 2 comments · Fixed by #8637
Closed

Rule PLR6301 ignore comment requires odd location #8635

ofek opened this issue Nov 12, 2023 · 2 comments · Fixed by #8637
Assignees
Labels
bug Something isn't working

Comments

@ofek
Copy link
Contributor

ofek commented Nov 12, 2023

Method `construct_build_command` could be a function, class method, or static method

The following is the proper way to ignore PLR6301 when the function/method spans multiple lines:

def construct_build_command(
    self,  # noqa: PLR6301
    *,
    directory=None,
    targets=(),
    hooks_only=False,
    no_hooks=False,
    clean=False,
    clean_hooks_after=False,
    clean_only=False,
):

Should it not be the case that ignore comments be on the method?

@charliermarsh
Copy link
Member

Yeah this seems off. I think it's flagging the self, but we should probably move it to the method name.

@charliermarsh charliermarsh self-assigned this Nov 12, 2023
@charliermarsh charliermarsh added the bug Something isn't working label Nov 12, 2023
charliermarsh added a commit that referenced this issue Nov 12, 2023
Previously, this rule used the range of the `self` annotation, but it's
a lot more natural to use the range of the function name (since it also
means the `# noqa` is associated with the method rather than its first
argument).

Closes #8635.
@ofek
Copy link
Contributor Author

ofek commented Nov 12, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants