How to find all unused methods of a class in PyCharm?

前端 未结 1 595
野趣味
野趣味 2021-01-03 22:13

I have a class named Article in my project. I want to find all its methods that are unused in the project. For a particular method I can press Alt+F7

相关标签:
1条回答
  • 2021-01-03 22:50

    PyCharm doesn't offer this feature since it isn't possible to reliably determine that a method is unused, because there are simply too many ways to call it dynamically.

    But you may use Vulture to find most of dead code in a project. Refer to the following commands:

    $ pip install -U vulture
    $ vulture path_of_project
    $ # Use --exclude for excluding particular files (e.g. virtualenv files)
    $ vulture --exclude=env path_of_project
    
    0 讨论(0)
提交回复
热议问题