What does #noqa in Python mean?

Asked

Viewed 586 times

10

Sometimes I find this comment in some Python code: #noqa.

What does it mean? It’s specific to Python?

  • 4

    NO Quality Assurance basically tells the line to be ignored by some programs that analyze source code.

2 answers

9

"No Q/A", that is, makes some tools(flake8 and pycodestyle ) ignore the errors contained in that specific line.

It’s style the // eslint-disable-line no-use-before-define from Eslint, the Javascript style guide.

  • 4

    Note that these "errors" are actually inconsistencies with the formatting patterns defined in these tools; not syntax errors. In short, if I want to put a blank space where it suggests not by, I can use the noqa to omit warning messages about formatting.

8


How do we know that not even the creator of language knows? :P :D

Jokes aside, for the Python language itself means nothing, it is even more specific than Python. As can be seen in link above is just a comment like any other that has external tool that understands the semantics in a special way. From what was said there is how the Flake8 utility ignores the recommendations of PEP8 in its analysis (others may have also adopted).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.