-
Notifications
You must be signed in to change notification settings - Fork 63
tag things with '# pyflakes.ignore' #22
base: master
Are you sure you want to change the base?
Conversation
+1 ! I'm waiting for that too :) |
+1 This is important to a lot of people. |
+1 |
3 similar comments
+1 |
+1 |
+1 |
I also want to override pyflakes in some cases, but I prefer not to clog my code with comments designed for computers. So instead of this patch I would prefer some mechanism to customize pyflakes for my whole package. For example: # pyflakes-custom.py
def pyflakes_filter(complaint):
if re.search("_.*imported but unused", complaint.msg):
return None
return complaint |
+1 Any reason not to merge this ? |
+1 |
The project seems dead (last commit from 10 months ago), and there are many problems with it (e.g. setup.py incompatible with virtualenv). Should we fork it and maintain it ourselves? |
@npinto The version on pypi (0.5.0) seems to be hosted by divmod folks (https://launchpad.net/pyflakes) and latest version was released last September. Also, according to #23 (comment) the divmod pyflakes seems up to date/active. What do you think? |
Good point, we should try to move everything to github on pyflakes/pyflakes. Submitted this request on launchpad: |
FYI: Subscribing to that bug increases it's "heat" by 2. The current high is 58. |
Hi! Do any of you know where / how to clone the official pyflakes source? I want to keep a GH clone of whatever is the official source. I believe the official source is in Launchpad but I can't seem to find a clear / easy way to clone whatever is official. In fact, in the official Launchpad source page, I can't find an Thanks in advanced, |
@jjmaestro According to the Pyflakes Launchpad, the source lives at https://launchpad.net/divmod.org/trunk - so I think you can do
..maybe? Launchpad is confusing. |
Hmmm... @dbr thanks for the hint! will try that and see what happens :D |
Nit: I would prefer that whatever mechanism we used to override pyflakes would also be natural for other static analysis tools to support. |
Just to offer two (admittedly very late) cents: I'm kind of opinionated about using comments to squelch the output from lint tools—I think it sucks. Comments in general tend to become useless over time. And in terms of general code base pollution, comments telling you (and, oh yeah, the static analysis tool that maybe only you use) that "up ahead lays some evil shit" are even worse. I deal with a semi-largish project frequently that has both vim mode lines, and emacs folding mode comments—sometimes in the same file!—and the amount of extraneous noise due to just those two things when you're mentally parsing a file for the first time is actually enough to be annoying. Do I have an alternative? What if we gave PyFlakes the ability to read in a blacklist of modules, or functions, or some combination of both, from some file? Remember how
There might even be existing syntax out there (or even better, code for parsing/handling) for this sort of "referring to parts of Python code" thing. We could add an option to make it an error for any of those declarations to point to code that doesn't exist anymore, so that if you wanted, you could be forced to keep it up to date. TLDR
Thoughts? (I'm going to try to keep this project up to date, now, btw...) |
I was actually thinking kinda the same thing, except I don't know how much I would use this with function-level granularity. Usually I just have a few specific lines I want to ignore. For instance, I've written code that tries I was thinking of having some kind of |
My only complaint about comments like If the lint-disabling message is short enough to fit nicely within a regular comment (by being shorter then
The separate |
I do like |
But I do think there's merit in being able to to ignore known pyflakes warnings, as there will always be cases where pyflakes isn't smart enough. |
I am just wondering if pull request #28 solves the most immediate need for this change? Would be glad if you could check. |
saper: yep, I just checked #28 against the code in amoffat/sh and it gets rid of all the redefinition warnings I wanted to see suppressed without breaking any legitimate warnings. I also played with some legitimate cases like
and it correctly warned, so I think it's as good as it's gonna be without risking being too aggressive in suppressing warnings. |
Pull request #28 addresses bug in pyflakes, while ignoring is rather for locally overriding something. For example see http://stackoverflow.com/questions/8427701/import-files-in-init-py - Django test discovery forces you to import everything into one module and you don't want to be warned about this, having dozens of not interesting warnings just masks the interesting ones. |
One of my uses cases for pyflakes is integrating into a testing/build system. As a result i found it necessary to have a way of skipping certain things that I'm choosing are "ok" to get to a point where i can enforce a "no warnings before deploy" type of rule.
(the specific warnings that i wanted to skip don't matter so much here, just that i needed that ability; mostly it was things where i had conditional re-imports or purposefully unused imports)
This change allows me to add a comment at the end of any python line which i want pyflakes to ignore.