Click or drag to resize

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.

Scope

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

Parameters
NameDescriptionDefault 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.

Categories

Explicit Rules, New Rules

Additional Information

There is no additional info for this rule.

Example Test Script
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

 MessageLineColumn
1EX0020 : Text `bug` found inside comments.1022
2EX0020 : Text `todo` found inside comments.162
3EX0020 : Text `hack` found inside comments.2017
See Also

Other Resources