3

Are there any tools available which help with Apex code refactoring?

With features like:

  • Renaming classes and updating all references
  • Renaming method names and updating all references
  • Finding usages of class/method
  • Finding redundant code
  • Change Signature
  • Convert Interface to Abstract Class
  • Convert Abstract Class to Interface
  • Extract Superclass
  • Transform Parameters
  • Replace Constructor with Factory Method
  • Convert Method to Property
  • etc

Something like ReSharper would be perfect :)


Note: I realise a similar question has been asked before, but that was 3 years ago, so hoping for a positive answer this time.

  • 4
    I don't think there's anything that exactly does what you want, but I've heard good things about IntelliJ's Illuminated Cloud plugin. It has a lot of nifty features that might be useful for you. – sfdcfox Jul 23 '18 at 19:29
  • @sfdcfox please could you write one? (exactly to my spec) :D – Robs Jul 23 '18 at 19:30
  • 3
    I wish I had the time to do it. It'd be a great time saver. I could try to implement some of this in DX/VS Code, I think it'd be pretty trivial because of VS Code's feature set, but it would still take me some time to get up and going. – sfdcfox Jul 23 '18 at 19:38
7

I know of two choices:

  1. Illuminated Cloud plugin for IntelliJ
  2. Welkin Suite based on Visual Studio

Both will meet most of your requirements.

But I believe IntelliJ + Illuminated Cloud is a better fit.

Both are licensed and pricy.

IntelliJ

  • Renaming classes and updating all references +
  • Renaming method names and updating all references +
  • Finding usages of class/method +
  • Finding redundant code +/- (If I remember well it highlights parts of the code which can be refactored to methods)
  • Change Signature +
  • Convert Interface to Abstract Class +/- (Hmm didn't try that but I think it can be done fairly well with IntelliJ refactoring capabilities
  • Convert Abstract Class to Interface +/-
  • Extract Superclass +
  • Transform Parameters + (Extracting fields you mean?)
  • Replace Constructor with Factory Method +
  • Convert Method to Property +
  • I'd forgotten about Welkin Suite. Have you tried that product? – sfdcfox Jul 23 '18 at 19:38
  • 2
    Yep for brief amount of time. It have great features connected to FLS (awesome interface that helps with managing permission sets for example) but have some limitations (like it can't subscribe for all metadata that's possible) andI think that they just included version control integration in new release. Also I think that lighnting components support is limited. One way or another I think it's not enough mature product but in some time it will be probably best choice if they manage to develop it further. My department (80 people) choose Intellij + Illuminated Cloud over Welkin Suite :) – user1974566 Jul 23 '18 at 19:43
  • 2
    I personally have used IC2 to do many of these items and it works great; license cost is trivial compared to value of my time to my org – cropredy Jul 24 '18 at 0:22
  • 1
    Just another enthusiastic bot for Illuminated Cloud. Wilkins did not fit the bell. The offline debugging in IC is great too. I could go on..... – Eric Jul 24 '18 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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