allow suppression of individual messages

Bug #1287336 reported by John Schmitt
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Pyflakes
New
Undecided
Unassigned

Bug Description

From https://flake8.readthedocs.org/en/2.0/ :

files that contain this line are skipped:

# flake8: noqa

I find Pyflakes preferable but I miss this feature from flake8. I would be happy if Pyflakes mimicked the flake8 feature that allows # Pyflakes noqa to suppress warnings.

Revision history for this message
Randy Syring (rsyring) wrote :

pull request for this functionality: https://github.com/pyflakes/pyflakes/pull/27

Revision history for this message
Florent (florent.x) wrote :

@marmalodak

I do not understand why you cannot use flake8 directly here.
Do we really need to duplicate all the features of flake8 into pyflakes?

@rsyring

I'm sorry but the repository was deleted few weeks ago on GitHub, and we've lost the pending pull requests in the middle.
This deletion was reported to the organization owner @kevinw and to GitHub but I did not receive a clear explanation.

Revision history for this message
John Schmitt (marmalodak) wrote :

@Florent, I think I do not understand your question.

Normally I don't even use flake8. I was asking for one feature from flake8, namely the ability to suppress messages on a given line. I don't understand how this feature in flake8 `duplicates all the features...` To be even more explicit, a line in my source code which contains this:

# Pyflakes: noqa

or something similar ought to suppress all warning messages from Pyflakes for that line.

If I'm still being ambiguous, I'll try to answer specific questions you have here.

Perhaps Randy Syring would be so kind to submit his pull request again?

Revision history for this message
Florent (florent.x) wrote :

I tried to clarify my advice through a new "tip" in the README: https://github.com/pyflakes/pyflakes#installation

Pyflakes is focused on doing analysis of the source code to bust some common pitfalls.

And the Flake8 tool is a small wrapper around Pyflakes (and pep8) which brings many convenient things, including the "# noqa" comment to ignore errors for the line.

IMHO it would be better to use Flake8 in your case : it avoids inventing a new syntax to suppress only the warnings of Pyflakes.

If don't bother about pep8, run Flake8 with the right switch:

    flake8 --select F my_project/

Revision history for this message
Florent (florent.x) wrote :

This is a duplicate of #907742

Revision history for this message
Randy Syring (rsyring) wrote :

@florent

I went ahead and submitted the pull request again.

I understand you don't like the concept. I don't particularily like it either. But in some rare cases it is helpful. Furthermore, if I could use flake8, I would. Unfortunately, my IDE supports pyflakes, not flake8, and I don't want to build a plugin for the IDE just to get linting support.

You are the project owner and have the right to reject the pull request. But I do think we have been clear about our use cases and why this would be helpful to us and why flake8 isn't the answer.

For anyone else who is interested, you can checkout Frosted, a fork of pyflakes: https://github.com/timothycrosley/frosted

That project has taken my pull request for pyflakes and used it in their pyflakes fork. If you really need this functionality, you may be able to switch to frosted. I haven't tried it yet with my IDE to see if it's compatible though.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.