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

🩹 Don't use colon after error code in message text for flake8 #22

Merged
merged 4 commits into from
Jun 5, 2023

Conversation

s-weigand
Copy link
Contributor

@s-weigand s-weigand commented Jun 3, 2023

The error code in the message passed to flake8 should not end with : since this causes problems with tools like yesqa that parse the flake8 output.

E.g. this nonsense example

def f(positive_nr: int):  # noqa: DOC502
    """Does something.

    Parameters
    ----------
    positive_nr : int
        Used to do something

    Raises
    ------
    ValueError
        If ``positive_nr`` is not a positive number.
    """
    ensure_positive(positive_nr) # raise value error if positive_nr is not positive
    result = ...
    return result

In this case yesqa would remove the noqa since it sees the error code reported as DOC502: instead of DOC502 (It uses flake8 formatting string --format=%(row)d\t%(code)s) which then does not match and the noqa gets removed.

@jsh9
Copy link
Owner

jsh9 commented Jun 5, 2023

Thanks @s-weigand for making this change!

@jsh9 jsh9 merged commit de8f5db into jsh9:main Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants