6

Java has a number of useful and FREE tools for reviewing not just formatting and style but quality of code and bad coding habits.

Checkmarx and Code scan could work but they are not free and open source.

Checkstyle works well for java but there are no official updates to support Apex.

What does static code analysis for apex that is free?

5
  • 1
    What's wrong with Checkmarx? Can you be more specific in your criteria? Because in my experience that code does seem to fulfill your needs. – Adrian Larson Mar 3 '16 at 1:59
  • @AtulRajguru9 Sorry for the confusion all. I updated the question to be more specific. I'm looking for open source / free static code analysis for apex. Currently the working solutions are paid. Will you consider this for reopen? – Chris Fellows Mar 3 '16 at 18:09
  • Checkmarx is free. I guess the open source part is a legitimate gripe, but I doubt you will find open source options. – Adrian Larson Mar 3 '16 at 18:19
  • Is it really? That would be terrific. Though I only see the free trial option on the website. – Chris Fellows Mar 3 '16 at 18:30
  • 2
    I wouldn't call Checkmarx a real static code analyzer for Apex. It only analyzes permission based (security) problems and was solely used to check code for the Salesforce Security Review in the past. You can check for naming, complexity, bug risk things there like you would expect from such a tool. – Robert Sösemann Apr 19 '16 at 18:50
8

We recently ported the famous Java Static code analyzer PMD to Apex. We also ported many of the original Java rules and created a few Apex specific to showcase how to write language-specific rules (e.g. AvoidSoqlInLoops, AvoidLogicInTriggers,...).

Other than CodeScan, our effort is open source and was merged back into the original PMD repository on Github (https://github.com/pmd/pmd). Every Salesforce developer or expert out there can fork the repo and create new and better rules and integrations.

As the Apex language module is now part of the regular PMD distribution all PMD-based tools also speak Apex now, e.g. the Eclipse / Force.com IDE.

enter image description here

We have also built an open-source engine for CodeClimate so you cannot only analyze files on your local machine but also have code checked into your Github repos verified.

enter image description here

0

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.