[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.5 Scoring Adjustments

Scores can be adjusted with three different options:

nesting-penalty

See section —nesting-penalty.

demi-nesting-penalty

See section —demi-nesting-penalty.

scale

See section —scale.

The raw score is the number of lines or statements, whichever is greater, adjusted by a factor for the depth of the logic. Statements are nested when they are inside of a block of statements for a “block” statement (viz., “do”, “for”, “if”, “switch” or “while”). Statements within blocks used to constrain the scope of variables (not controlled by a block statement) are not multiplied by this factor.

Expressions are nested when contained within parentheses. The cost of these is different. Block level nesting multiplies the score for the block by the --nesting-penalty factor (2.0 by default). Nested expressions are multiplied by the --demi-nesting-penalty, the square root of --nesting-penalty by default.

Some attempt is made to judge the complexity of an expression. A complicated expression is one that contains an assignment operator, more than one relation operator, or a mixture of “and” and “or” operators with any other different kind of non-arithmetic operator. Expression scores are minimized by:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Bruce Korb on May 15, 2011 using texi2html 1.82.