Add support for ignoring some warnings
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
Won't Fix
|
Wishlist
|
Unassigned | ||
pocket-lint |
Fix Released
|
Low
|
Adi Roiban |
Bug Description
It would be nice if pyflakes would provide an option for ignoring some warnings.
For example I have this code:
try:
from setproctitle import setproctitle
except ImportError:
setproctitle = lambda t: None # pyflakes:ignore
And pyflakes will complain that setproctitle is redefined.
Maybe this is a bad code and this kind of things should be never ignored, but I just want to know if such a feature is wanted in pyflakes.
Here is a workaround for implementing pyflakes:ignore
class PocketLintPyFla
'''PocketLint checker for pyflakes.
This is here to work around some of the pyflakes problems.
Beside the AST tree, it is also initialized with the plain text content
of the file.
'''
def __init__(self, tree, filename='(none)', text=None):
self.text = text
if self.text:
def report(self, messageClass, *args, **kwargs):
text_lineno = args[0] - 1
if self.text[
return
Related branches
- Curtis Hovey: Approve (code)
- Adi Roiban (community): Abstain
-
Diff: 64 lines (+35/-1)2 files modifiedpocketlint/formatcheck.py (+24/-1)
pocketlint/tests/test_python.py (+11/-0)
Changed in pocket-lint: | |
status: | New → Triaged |
importance: | Undecided → Low |
Changed in pocket-lint: | |
milestone: | none → 0.5.31 |
Changed in pocket-lint: | |
assignee: | nobody → Adi Roiban (adiroiban) |
status: | Triaged → Fix Committed |
Changed in pocket-lint: | |
status: | Fix Committed → Fix Released |
I'd rather fix the bugs in pyflakes that lead to spurious warnings.