Introducing Clayton, automated code reviews for Apex

Salesforce developers and technical architects of the world, I am very pleased to introduce Clayton.io, the code review robot for Salesforce apps.

What is Clayton?

Clayton is a code review robot that keep code quality under control for any Salesforce project. If your development team use GitHub or Bitbucket to collaborate on code, Clayton will watch the code throughout its development, and will automatically code review every new feature as soon as it's added. Clayton runs in the cloud, so you don't need to install anything to use it.

This code review comment was added automatically by Clayton as soon as the pull request was created.

Automating code reviews in the development process.

I have worked on many Salesforce implementations throughout my career, and quality was often a challenge. Either dealing with bad previously existing code, unexperienced developers, or lack of a good technical leadership. One of the first things I would put in place is a sound code review process, I also blogged about it previously. The reality is that many of the checks that should be done as part of a code review are actually repeatable, therefore they could be automated. Code that doesn't pass these checks shouldn't be accepted in the development branch, and this is pretty much what Clayton does.

The comments in the pull request are generated by Clayton. The pull request is checked automatically and the overall result of the review (pass/fail) is added by Clayton to the pull request.

Benefits

  • Monitor and measure code quality (you can't improve what you don't measure)
  • Ensure best practices are followed by all developers
  • Enforce naming conventions
  • Keep code manageable and easy to maintain
  • Give developers early feedback when something should be reworked

Checks: what Clayton actually looks for

I started implementing 15 core checks in Clayton's engine. I will add more over time, so that everyone using it can benefit from newly available checks in a true multi-tenant fashion.

Area Checks
Performances/Best Practices
  • Hardcoded IDs
  • SOQL in loops
  • DML in loops
  • Unbound SOQL that might return too many records
  • Tests methods that can access all data
Complexity
  • Nested IFs
  • Excessively large classes
  • Excessively long methods
  • Methods with too many parameters
Style
  • Class, triggers, interface naming conventions
  • Methods naming conventions
  • Trivial method names
  • Variable naming conventions
  • Use of single-letter variables
  • Test methods without annotations

Cool! Can I use it on my projects?

Yes, you can. I am really keen to get as many developers as possible to use it to enjoy the benefits and share valuable feedback to help me shaping the future of the product. Just go on clayton.io and sign up.

Is it free?

Clayton is free to use for all open source projects. If your project is private, there is currently a flat per project pricing. Since Clayton is in early days and I am keen to get as much feedback as possible, I am offering free passes for every team that want to join our early adopters pilot, and test Clayton on a real implementations. If you are interested just get in touch!