0

We have some guideline for writing code and follow coding standard from java.

For example :

List<String> listVar = new List<String>();

In the above 'List' L should be caps. 'String' S should be caps. variable name begin with small letter.

While review ,we check all the standard what we have defined in our org. It should be implemented Otherwise it wont go prod.

Most of the developers just ensure logic and ignore the format at beginning . Then they got frustrated when they want to follow formatting. Its dragging time.

So we decided to write a tool. once they uploaded the code,Which tells the line and column where you should change the small case to uppercase. There are huge set of rules.

I am facing Starting trouble.

How to read lines and word and store the error in somewhere.?

Any API or anything handy or anyone experienced before...

I thinking to keep this in public once its completed. So that anyone can get benefit.

  • 3
    Rather than building this from scratch I suggest instead that you leverage an existing tool such as Checkstyle. – Keith C Dec 24 '16 at 10:05
2

It would be most sensible to use an existing tool of which there are a number. I do not have experience of using any of these so you would need to do further research.

Open source

Andrew Fawcett's Apex-CodeAnalysis tool - open source so can be customised to fit requirements and would be free to use.

Commercial

Clayton - I have seen this demoed, but not tried it yet. Has a freemium model with public repositories free.

Codescan - found this on AppExchange by searching.

0

Instead of reinventing the wheel, please use some standard framework like SonarQube.There are salesforce plugin available .You can write your custom rules.The Sonarqube has excellent dashboard and all users/developers can access the audit report via a portal.

  • From a quick glance it does not appear SonarQube supports Apex or Salesforce. What is required to use it with Apex? – Eric Dec 25 '16 at 5:53
0

Any Illuminated Cloud users ("force.com IDE" equivalent plugin for IntelliJ IDEA) will already have access to the "usage case does not match declaration case" and "keyword does not match preferred case" type inspections in Apex, which come with handy "fix all" options. These allow us to address case mismatch for keywords as well as SObject, Field, Apex class, method and variable names, be they custom or OOTB/API.

-1

I'm Gabriele, part of the Clayton team.

Just wanted to let you know guys that we did a re-branding of Clayton this year. You can reach the new website with the following link: https://www.getclayton.com/

Feel free to contact us in case you need help. Thanks!

  • Hey gabriel can you give more specs about clayton and how it helps the question, currently it just looks like a promotion – Pranay Jaiswal Nov 20 '18 at 20:06
  • Hey Gabriele, I'm not going to delete this straight off because Clayton does look relevant, but can you include some detail here? Knowing it's been re-branded isn't a lot of use :) – Matt Lacey Nov 21 '18 at 1:46
  • You are getting flagged for spam and receiving automatic downvotes because of it. Please note that while you have done a great job disclosing your affiliation, posters who contribute no content besides promotion for a product may still be considered spammers. I have declined both spam flags for now, but it's a pattern that may see all your posts (and possibly even account) deleted if it never diverges. Just a heads up! Best of luck to you and the Clayton team. – Adrian Larson Nov 21 '18 at 13:09
  • Hi guys, thanks for your comments and sorry about the misunderstanding. I wanted to be transparent that's why I disclosed my affiliation to the team. I mentioned only a rebranding because Clayton was already mentioned above. – Gabriele Gallo Stampino Nov 21 '18 at 14:21
  • Coming to the question: we have a dedicated set of rules that can help on enforcing naming conventions and code standards. You can have a look at our help page: help.clayton.io/rule-documentation Thanks and sorry again! I wanted to help not spam :-) – Gabriele Gallo Stampino Nov 21 '18 at 14:29

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.