EX0020 : Specified text found in comments

The topic describes the EX0020 analysis rule.

Message

Specified text found in comments

Description

This rule checks comments and reports when a configured regular expression is matched.

How to fix

The rule is only informational.

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters
Name Description Default Value
CommentTextMatchRegex

Regular expression that to be matched in comments.

regexp:Fix|Hack|Todo|Bug|Issue

IgnoreCase

The parameter specifies whether to ignore the matched text case.

yes

Remarks

The rule does not need Analysis Context or SQL Connection.

Effort To Fix
5 minutes per issue.
Categories

Explicit Rules

Additional Information

There is no additional info for this rule.

Example Test SQL
SQL
 1CREATE PROCEDURE [dbo].[uspGetWhereUsedProductID]
 2  @StartProductID  [int]
 3, @CheckDate  [datetime]
 4AS 
 5BEGIN
 6    SET  NOCOUNT ON;
 7        DECLARE @result int 
 8
 9        BEGIN TRY
10        SELECT @result = 1/0 -- bug
11        /*
12                some other comment 
13        */
14        END TRY
15        BEGIN CATCH
16                -- todo: add error handling
17                PRINT 'Division by 0'
18        END CATCH
19
20        SET @result = 5 -- hack 
21
22        RETURN @result;
23END

Analysis Results
  Message Line Column
1 EX0020 : Text `bug` found inside comments. 10 22
2 EX0020 : Text `todo` found inside comments. 16 2
3 EX0020 : Text `hack` found inside comments. 20 17
See Also

Other Resources