mirror of
https://github.com/github/codeql.git
synced 2026-03-01 21:34:50 +01:00
33 lines
859 B
XML
33 lines
859 B
XML
<!DOCTYPE qhelp PUBLIC
|
|
"-//Semmle//qhelp//EN"
|
|
"qhelp.dtd">
|
|
<qhelp>
|
|
|
|
|
|
<overview>
|
|
<p>
|
|
This rule finds switch statements that have too much code in their cases.
|
|
Long case statements often lead to large amounts of nesting, adding to the difficulty of understanding what the code actually does.
|
|
Consider wrapping the code for each case in a function and just using the switch statement to invoke the appropriate function in each case.
|
|
</p>
|
|
|
|
<p>The indicated switch statement has a case that is more than 30 lines long.</p>
|
|
|
|
</overview>
|
|
<recommendation>
|
|
<p>Consider creating a separate function for the code in the long case statement.</p>
|
|
|
|
</recommendation>
|
|
<example><sample src="SwitchLongCase.cpp" />
|
|
|
|
</example>
|
|
<references>
|
|
|
|
<li>
|
|
<a href="http://www.learncpp.com/cpp-tutorial/53-switch-statements/">Switch statements</a>
|
|
</li>
|
|
|
|
|
|
</references>
|
|
</qhelp>
|