Context
Since I have a workspace with multiple python/github repositories, vulture does not return all dead Python code. So to find all uncalled functions, I use the following steps:
- Search all functions, with:
CTRL+SHIFT+F
,Alt+R
,^(\s*)(def [\w_]+\()
- Then I open all those search results in a new tab with:
Alt+Enter
. - Then manually, for each function, I search with
CTRL+SHIFT+F
how often that function occurs in the search results, and if it occurs only once, I know it is dead code.
Since this is an iterative process, where deleting one function can sometimes make other functions uncalled, it becomes quite time consuming.
Question
How can one automatically return a list of all python functions (within a workspace in vscode)/(across a set of folders), that occur only once (at its creation with def function_name(..
, whilst never being called)?
Assumption
I assume no duplicate function names exist within these projects.