2

Concept of this question is to gather information on how you would proceed to gather information about whether a function and/or class is in use in the entirety of an application.

Background information

The application is 3-5 years old, based originally on Python 2.4 (Upgraded over the years to latest Python 2.7.11), Django 1.0 (Upgraded over the years to 1.4.22), some custom frameworks which implement some ruby on rails magic (Create a controller file with function names and they turn into an HTTP endpoint, functions with _ infront will not be visible to the enduser), total number of endpoints, derived from django.url* tells me I have to manually create 100 endpoints for various needs and purpose. Number of Django apps/modules is around 20, they are entangled into each other, and I know not all are used, but heres the thing, how would I proceed to gather information to tell which function are used or not? So I could do a refactoring of the code, to reduce noise?

I've used PyCharm and its intelligence but based on how the application and how Python works, some of the suggestion are making the application not working.

Example of above: some functions in models, and views are not using self and then PyCharm thinks 'well this function can be changed to a static method' but somewhere else in the code the previous developer use self."function_name" and by using that call it actually imply "Please provide me with self and the argument".

TLDR: How to proceed to weed out dead and not used code in an easy and efficient way? Thanks for all input in advance.

2
  • That sounds like spaghetti code. I assume there is no test suit, is there? This might help: stackoverflow.com/questions/9524873/… Commented Jun 15, 2016 at 13:26
  • Your assumption is wrong wink, I got test code in the project, but that is not saying the test is right, which they aren't. Commented Jun 15, 2016 at 13:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.