mgalloy / idldoc

Documenting IDL code
Other
21 stars 13 forks source link

Compute complexity statistics #1

Closed mgalloy closed 11 years ago

mgalloy commented 11 years ago

McCabe complexity statistics (McCabe cyclic, McCabe essential, McCabe modular design) were computed in the IDLdoc 2.0 code base. This functionality should be added to the IDLdoc 3.0 code base, though possibly in a simplified manner (i.e. reporting just one number).

Also, there should be user-defined limits for marking a routine as "complex" on the warnings page.

References for more information about the McCabe complexity statistics:

mgalloy commented 11 years ago

r617 adds basic cyclomatic complexity calculations. There are user-defined limits with the COMPLEXITY_CUTOFFS keyword. The complexity computation should be further refined because currently it will parse comments and string literals while also not counting CASE and SWITCH statements correctly.

mgalloy commented 11 years ago

There is a better IDL code parser now in the complexity calculation and modified cyclometric complexity is now computed as well. But to get the complexity right, a full IDL parser (or more heuristics) is needed because the : indicating a case in a SWITCH or CASE statement is also used in the ternary operator, a label, and array indexing.

mgalloy commented 11 years ago

8e0dd398129bf66367794a170f11bf9a11d2ea63 adds bracket level as a heuristic to determine what type of : is used. Problems with this approach:

  1. misses ternary operators inside parentheses or square brackets
  2. counts labels, but this might be a good idea to count towards complexity since a label is generally used with GOTO or ON_IOERROR as a target to jump to

This is not perfect, but I think that a full IDL parser would not be worth it.