Bug 318886 - Add PyFlakes support to kdev-python
Summary: Add PyFlakes support to kdev-python
Status: CONFIRMED
Alias: None
Product: kdev-python
Classification: Developer tools
Component: Language support (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: 1.4.0
Assignee: Sven Brauch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-25 22:54 UTC by Luca Beltrame
Modified: 2019-04-18 19:58 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Beltrame 2013-04-25 22:54:24 UTC
PyFlakes is a widely used static analysis tool for Python. Having support for it, like pep8, would allow to:

- check for defined but unused imports;
- check for defined but unused variables

However this would require a little parsing from pyflakes as it also reports undefined names, something that kdev-python already does.  

Reproducible: Always
Comment 1 Sven Brauch 2013-04-25 22:57:59 UTC
It's a valid wish, but it would probably be easier to do this completely in kdev-python instead of integrating flake. Both features should be just few lines of code to write.
Comment 2 Luca Beltrame 2013-04-25 23:03:57 UTC
Interesting checks nice to have inside:

- Imported but unused
- redefinition of unused variable
- list comprehension that redefines variable
- import shadowed by variable
- undefined name in __all__
- duplicate argument in function definition
- redefinition of variable
- future imports after other statements
- variable assigned but never used

Those should be the most interesting ones.
Comment 3 Sven Brauch 2013-04-26 11:15:59 UTC
Thinking of it, don't we have a seperate plugin (an unfinished one?) for this kind of checks? Andreas, can you comment on that?

Cheers
Comment 4 Andreas Pakulat 2013-04-26 13:41:04 UTC
I have no clue what you're talking about :) Aleix once worked on something to cleanup includes in c++, but that was c++ specific afaik.
Comment 5 Sven Brauch 2013-04-26 13:53:04 UTC
Yeah, you know, Aleix, Andreas... it's easy to mix up... *ducks*
I'm sorry! I meant to ping aleix ;)
Comment 6 Aleix Pol 2013-04-26 14:01:04 UTC
We have the ILanguageCheck and ILanguageChecksProvider interface so that you can run whatever you want against a file, then add the problems that have been found to the TopDUChain so that they can be displayed  in the UI or wherever you want.

You can see the kdevchecksrunner plugin for more information about it. I'll be working on this, so if you have any idea about it, don't hesitate to tell me.
Comment 7 Sven Brauch 2013-04-26 14:27:36 UTC
Okay, good to know! I guess this would be the best way to do it, then. I'll surely want to work it at some point in the future, I'll come back to you then.