(N.b.: I was unable to write this post without saying "ssscrrrrutinizer" out loud over and over. I blame my friend Ray Chavarie for inflicting Frank Zappa on me at an impressionable time in my life.)
After finishing Uncle Bob's excellent Clean Code recently, I have been looking at my own code in Aura v2 even more critically. I started trying to apply more of the Clean Code principles to the different libraries, and thought I had done pretty well. But then I saw a scrutinizer.yml
file in Luis Cordova's Gush project, and I was curious about it.
I visited scrutinizer-ci.com to read up on the project, and man was I floored. Here is a service that will analyze your project on Github and assign it a quality grade that aligns really well with the Clean Code principles (among others). After you register a repository with Scrutinizer and perform the first analysis, you can fine-tune the process with a config file so that the Scrutinizer looks in the right directories for source code, gives you code coverage analysis, and so on.
For one of my first experiments with the Scrutinizer, I started with the Aura.Sql_Schema v2 package. I thought it would come out pretty well, but even after pointing the Scrutinizer in the right direction, it only scored an 8.61 or so. I guess that's OK -- but could we do better?
Using the Hot Spots page I was able to find the worst offenders in the classes and methods. Because we have 100% test coverage on all Aura code, it was a only matter of applying appropriate refactorings -- the tests help to assure that changes don't break anything. (The Scrutinizer will even suggest refactorings for you to apply.)
After the refactoring processes, the Scrutinizer reported a 9.46. You can see the Scrutinizer report for Aura.Sql_Schema here. There's still room for improvement, but at least I know where the greatest improvement opportunities are.
Now that I've got a few days' experience with Scrutinizer, I find it a very valuable tool. It's very helpful as an objective assesment of code quality, so much so that I have added Scrutinizer badges to each Aura v2 package readme. You can see all the badges for all the packages on the v2 packages page.
Maybe the rest of the world knew about Scrutinizer before this, and I'm late to the game. I had not heard about it until recently, and now that I'm aware of it, I think it's a great service for any developer concerned about code quality. Congratulations to @schmittjoh and everyone else involved in Scrutinizer. Very nicely done!
UPDATE: In response to a question elsewhere: yes, Scrutinizer is free for open-source projects.
Read the Reddit discussion about this post here.