Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 87a4371

Browse files
authored
Merge pull request #1588 from felicity-semmle/qhelp/SD-3447-commented-out-code
Update Python and C# help for commented-out code to use common qhelp
2 parents 48842c8 + cb48af7 commit 87a4371

6 files changed

Lines changed: 23 additions & 51 deletions

File tree

csharp/ql/src/Bad Practices/Comments/CommentedOutCode.qhelp

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,6 @@
22
"-//Semmle//qhelp//EN"
33
"qhelp.dtd">
44
<qhelp>
5-
<overview>
6-
<p>
7-
Commented-out code is distracting and confusing for developers who read the surrounding code,
8-
and its significance is often unclear. It should therefore be avoided.
9-
</p>
10-
11-
</overview>
12-
<recommendation>
13-
14-
<p>
15-
Remove the commented-out code, or reinstate it if necessary.
16-
</p>
17-
18-
</recommendation>
19-
<references>
20-
21-
<li>High Integrity C++ Coding Standard: <a href="http://www.codingstandard.com/rule/2-3-2-do-not-comment-out-code/">2.3.2 Do not comment out code</a>.</li>
22-
23-
</references>
5+
<include src="CommentedOutCodeQuery.qhelp" />
6+
<include src="CommentedOutCodeReferences.qhelp" />
247
</qhelp>

csharp/ql/src/Bad Practices/Comments/CommentedOutCode.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @name Commented-out code
3-
* @description Comments that contain commented-out code should be avoided.
3+
* @description Commented-out code makes the remaining code more difficult to read.
44
* @kind problem
55
* @problem.severity recommendation
66
* @precision medium

python/ql/src/Lexical/CommentedOutCode.qhelp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"qhelp.dtd">
44
<qhelp>
55
<include src="CommentedOutCodeQuery.qhelp" />
6-
<include src="CommentedOutCodeCommon.qhelp" />
6+
<include src="CommentedOutCodeExample.qhelp" />
7+
<include src="CommentedOutCodeReferences.qhelp" />
78
</qhelp>

python/ql/src/Lexical/CommentedOutCode.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* @name Commented out code
3-
* @description Commented out code causes visual clutter as it is neither code nor comment.
2+
* @name Commented-out code
3+
* @description Commented-out code makes the remaining code more difficult to read.
44
* @kind problem
55
* @tags maintainability
66
* readability

python/ql/src/Lexical/CommentedOutCodeCommon.qhelp

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE qhelp PUBLIC
2+
"-//Semmle//qhelp//EN"
3+
"qhelp.dtd">
4+
<qhelp>
5+
6+
<example>
7+
<p>
8+
In the following example, a <code>print</code> statement, originally used
9+
for debugging, is left in the code, but commented out. It should be removed altogether.
10+
</p>
11+
12+
<sample src="CommentedOutCode.py" />
13+
14+
</example>
15+
16+
</qhelp>

0 commit comments

Comments
 (0)