afawcett / apex-codeanalysis

Force.com Apex code analyser using the Tooling API and Canvas
BSD 3-Clause "New" or "Revised" License
50 stars 49 forks source link

Apex Code Analysis Tool using Tooling API and Canvas

This tool utilises the new Spring'13 Tooling API and the Canvas technology to fill a gap in the Apex developers toolkit. That being the ability to perform analysis on the Apex code they are developing. This initial prototype shows how the SymbolTable information can be used to list unused Apex methods. More information and background to this can be found at my blog here. For more information on how to run and deploy this sample, please refer to the Force.com Canvas Developers Guide.

Screenshot

For more information see my blog entry Spring'13 Clean Apex Code with the Tooling API.

Generating the Tooling API Client Proxies (with JAX-WS) and Maven

In order to consume the Tooling API in Java I chose the SOAP protocol, since Java is a type safe language and interacting with the data types and operations of the API is much easier using Java's native features. These are the steps I took to accomplish this in Maven, you may want to use a different tool or approach.

I am not sure if the Salesforce WSC compiler tool would have had these issues, thats something I want to look into. However for now the JAX-WS tool does work great inside a Maven build project once the above is sorted.