mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
QL code and tests for C#/C++/JavaScript.
This commit is contained in:
33
cpp/ql/src/Metrics/Functions/StatementNestingDepth.qhelp
Normal file
33
cpp/ql/src/Metrics/Functions/StatementNestingDepth.qhelp
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE qhelp PUBLIC
|
||||
"-//Semmle//qhelp//EN"
|
||||
"qhelp.dtd">
|
||||
<qhelp>
|
||||
<overview>
|
||||
<p>
|
||||
This metric measures the maximum nesting depth in a file. This includes nested branch and loop statements, but not blocks.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Deep nesting makes code very difficult to read and modify, and is also a sign that a function/class has lost cohesion
|
||||
(i.e. is doing too many unrelated things). Try to keep nesting depth below 7 levels.
|
||||
</p>
|
||||
|
||||
</overview>
|
||||
<recommendation>
|
||||
<p>Reduce the nesting in the file by putting the code in the inner loops/branches in separate functions.</p>
|
||||
|
||||
</recommendation>
|
||||
<references>
|
||||
|
||||
<li>
|
||||
M. Fowler. <em>Refactoring</em>. Addison-Wesley, 1999.
|
||||
</li>
|
||||
<li>
|
||||
<a href="en.wikipedia.org/wiki/Code_refactoring">Wikipedia: Code refactoring</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.jot.fm/issues/issue_2005_01/column1/">Refactoring as Meta Programming?</a>
|
||||
</li>
|
||||
|
||||
</references>
|
||||
</qhelp>
|
||||
Reference in New Issue
Block a user