Tidy up - unused views and urls

Being a noob I have proudly sort of finished my first project from the ground up without it being a codealong, tutorial or similar.

Now I have a moment of reflection and I realize I might have several unused urls, views and other “forgotten” parts of ghe code, maybe from testing, failed tries and so forth.

Is there any way to spot these “can be deleted” snippets? Should I even bother?

I know of no automated way of doing this.

If you have a url, it refers to a view. The view needs to exist, otherwise the url definition is invalid. And, with a url, you can’t programmatically determine whether or not it’s being used, because someone can always enter a url directly in the address bar.

So only someone familiar with the code can do that sort of clean-up - and yes, I do recommend it be done. It can create a lot of confusion if you come back to this code after six months to try and figure out what’s going on.

Check in your current code to the repository-of-your-choice to ensure you have a working version, then start cutting away. (If you have tests for that code, make sure you remove those as well.)

Side note: In the future, when you’re doing this sort of experimentation, you may find it worthwhile to create branches for that purpose. If the work is good, merge it into your main branch. If not, you can always go back to main and ignore (or remove) that branch. It may seem to be a bit much at first, but my experience has been that I wouldn’t want to do it any other way now.

Thank you. I will try to learn git branching. And I will also do some manual cleanup. Thank you :slight_smile: