When RubyCritic runs, each analysed class or module gets assigned a rating - a letter from A to F, A being the best. This serves as a baseline to tell you how smelly the code is. Generally A's & B's are good enough, C's serve as a warning and D's & F's are the ones you should be fixing.
Similarly, a global score that ranges from 0 to 100 is calculated, where higher values are better - less code smells detected. This provides a quick insight about the overall code quality.
RubyCritic's rating system was inspired by Code Climate's, you can read more about how that works here. Note that the global score is fairly different from Code Climate's GPA, although it serves the same purpose.
As you know RubyCritic wraps around static analysis gems such as Reek, Flay and Flog to provide a quality report of your Ruby code.
Each of these gems are considered an Analyser that have a list of AnalysedModules, which have the notion of cost and rating.
Rating is simply a convertion from a number (cost) to a letter. So we need to understand what defines the cost of an AnalysedModule:
Each AnalysedModule basic goal is to catalog smells in the code analysed, assiging a number defined as cost. The definition of this cost varies from tool to tool, but it's always a non-negative number, with high values indicating more cost (worse smells).
This is basically an average of the cost of each AnalysedModule, scaled to the range [0..100]. There is a threshold to avoid very bad modules from having excessive impact.
3 points:
1.)
Should be
shouldn't it?
Edit: Just realized we don't have "E" which I find highly confusing since it seems to be alphabetical when it's not :(
2.)
"conversion"
3.) This just shows how confusing our rating system is. Look at this:
Ok, the higher the value the more cost, the worse it is. Understood!
Now let's look at the next paragraph:
Ok, "average of cost". But above we say that "the higher the number of the score, the better".
So we have two completely orthogonal metrics. Costs == "the higher, the worse". And the "score" == "the higher, the better".
I know that we can't fix this right now since this would be a bigger pull request, but we should make the difference crystal clear in our docs.