Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I am noticing there is a lot of redundant code in the Apex project I am working on. Is there any special way / tool or whatever to figure out what code never gets called in your code base?

Thanks.

share|improve this question
    
Check out this question: salesforce.stackexchange.com/questions/1697/…. Perhaps some of the static code analysis tools can do what you want. –  Peter Knolle Dec 18 '12 at 12:54
add comment

2 Answers

up vote 1 down vote accepted

At present there are no refactoring tools as such, though depending on how confident you are about the functional coverage of your Apex tests. You can utilise the code coverage as measure for this, you can also view in a colour coded way, code covered and that not.

Do make sure if your building a managed package, that before you release you scan at least for classes that are marked as 'global' as these can only be cleaned out and not removed once released.

share|improve this answer
add comment

Yeah, it calls apex test class. After running a test class you can check the code coverage and see what code is really in use.

enter image description here

share|improve this answer
    
This just shows which code has test code right. You may have code + test code, but never really use that code for anything functional. –  Samuel De Rycke Dec 18 '12 at 12:48
    
But then you know that you have a test code that is never used. My example is for subconsciously unused code. –  mast0r Dec 18 '12 at 12:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.