Difference between revisions of "Tracking Code Quality"
From CitconWiki
Jump to navigationJump to search (New page: References: # T.J. McCabe, "A complexity measure," IEEE Trans. Software Eng. vol. SE2, no 4, pp 308-320, 1976 # B.A. Nejmeh, "NPATH: a measure of execution path complexity and its applica...) |
|||
| (5 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
| − | References | + | == Tracking Code Quality == |
| + | * Presentation by Marty Andrews | ||
| + | * The [http://en.wikipedia.org/wiki/Cyclomatic_complexity Cyclomatic Complexity] of a method is really the minimum number of unit tests needed to test very path in a method. | ||
| + | * By reducing CC, usually by breaking large methods down, you reduce the number of tests you need to write! | ||
| + | * Complexian - www.cogentconsulting.com.au/resources/complexian/index.html | ||
| + | * FindBugs - usually needs human to interpret. Good to hook in but not run in CI. Human can run so often | ||
| + | * SourceMonitor | ||
| + | * JOODI - Package level checking. Good to enforce certain layers only access other layers e.g. | ||
| + | * Spec# | ||
| + | * [http://atlassian.com/clover Clover2] | ||
| + | ** Project Risk Coverage Cloud - A tag cloud containing every class that exposes those which have low test coverage but high cyclomatic complexity | ||
| + | ** Custom Columns - Define your own quality metric by combining any of Clover's built in ones | ||
| + | ** Track code quality over time using historical charts and reports | ||
| + | |||
| + | === Industry standard CCN numbers === | ||
| + | * There was some discussion over what is an unacceptably high CCN. I ([[User:JerryShea|JerryShea]]) don't like to see CCN above 20 personally. I have seen this table reproduced in a few places, including [http://www.linuxjournal.com/article/8035 this linuxjournal article]: | ||
| + | {| class="wikitable" | ||
| + | |- | ||
| + | ! CCN | ||
| + | ! Interpretation | ||
| + | |- | ||
| + | | 1-10 | ||
| + | | a simple program, without much risk | ||
| + | |- | ||
| + | | 11-20 | ||
| + | | more complex, moderate risk | ||
| + | |- | ||
| + | | 21-50 | ||
| + | | complex, high risk | ||
| + | |- | ||
| + | | 51+ | ||
| + | | untestable, very high risk | ||
| + | |} | ||
| + | |||
| + | === References === | ||
# T.J. McCabe, "A complexity measure," IEEE Trans. Software Eng. vol. SE2, no 4, pp 308-320, 1976 | # T.J. McCabe, "A complexity measure," IEEE Trans. Software Eng. vol. SE2, no 4, pp 308-320, 1976 | ||
# B.A. Nejmeh, "NPATH: a measure of execution path complexity and its applications," Commun, ACM, vol 31, no 2, pp 188-200, 1988. | # B.A. Nejmeh, "NPATH: a measure of execution path complexity and its applications," Commun, ACM, vol 31, no 2, pp 188-200, 1988. | ||
| − | # Wikipedia:Cyclomatic_complexity | + | # [http://en.wikipedia.org/wiki/Cyclomatic_complexity Wikipedia:Cyclomatic_complexity] |
# Complexity Analyser for Java, http://www.martyandrews.net/resources/complexian.html | # Complexity Analyser for Java, http://www.martyandrews.net/resources/complexian.html | ||
# Complexity Analyser for C++, http://gnocchi.sourceforge.net/ | # Complexity Analyser for C++, http://gnocchi.sourceforge.net/ | ||
| + | # Clover2, http://atlassian.com/clover | ||
Latest revision as of 13:55, 29 June 2008
Tracking Code Quality
- Presentation by Marty Andrews
- The Cyclomatic Complexity of a method is really the minimum number of unit tests needed to test very path in a method.
- By reducing CC, usually by breaking large methods down, you reduce the number of tests you need to write!
- Complexian - www.cogentconsulting.com.au/resources/complexian/index.html
- FindBugs - usually needs human to interpret. Good to hook in but not run in CI. Human can run so often
- SourceMonitor
- JOODI - Package level checking. Good to enforce certain layers only access other layers e.g.
- Spec#
- Clover2
- Project Risk Coverage Cloud - A tag cloud containing every class that exposes those which have low test coverage but high cyclomatic complexity
- Custom Columns - Define your own quality metric by combining any of Clover's built in ones
- Track code quality over time using historical charts and reports
Industry standard CCN numbers
- There was some discussion over what is an unacceptably high CCN. I (JerryShea) don't like to see CCN above 20 personally. I have seen this table reproduced in a few places, including this linuxjournal article:
| CCN | Interpretation |
|---|---|
| 1-10 | a simple program, without much risk |
| 11-20 | more complex, moderate risk |
| 21-50 | complex, high risk |
| 51+ | untestable, very high risk |
References
- T.J. McCabe, "A complexity measure," IEEE Trans. Software Eng. vol. SE2, no 4, pp 308-320, 1976
- B.A. Nejmeh, "NPATH: a measure of execution path complexity and its applications," Commun, ACM, vol 31, no 2, pp 188-200, 1988.
- Wikipedia:Cyclomatic_complexity
- Complexity Analyser for Java, http://www.martyandrews.net/resources/complexian.html
- Complexity Analyser for C++, http://gnocchi.sourceforge.net/
- Clover2, http://atlassian.com/clover