Click or drag to resize

SA0035 : TODO,HACK or UNDONE phrase found in a comment

The topic describes the SA0035 analysis rule.

Message

TODO,HACK or UNDONE phrase found in a comment

Description

This rule checks comments for one of TODO,HACK and UNDONE phrases. Consider checking this comments and completing the unfinished tasks.

Scope

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

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

Design 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    -- TODO : Validate parameters and check @CheckDate is not null.        
 8
 9    WITH  [BOM_cte](  [ProductAssemblyID]
10                    , [ComponentID]
11                    , [ComponentDesc]
12                    , [PerAssemblyQty]
13                    , [StandardCost]
14                    , [ListPrice]
15                    , [BOMLevel]
16                    , [RecursionLevel]) -- CTE name and columns
17        AS (SELECT    
18                        b.[ProductAssemblyID]
19                      , b.[ComponentID]
20                      , p.[Name]
21                      , b.[PerAssemblyQty]
22                      , p.[StandardCost]
23                      , p.[ListPrice]
24                      , b.[BOMLevel]
25                      , 0 -- Get the initial list of components for the bike assembly ( HACK test )
26
27            FROM      
28                        [Production].[BillOfMaterials] b
29            INNER JOIN  [Production].[Product] p
30            ON          b.[ProductAssemblyID]=p.[ProductID]
31            WHERE   
32                        b.[ComponentID]=@StartProductID
33                    AND @CheckDate>=b.[StartDate]
34                    AND @CheckDate<=ISNULL(  b.[EndDate]
35                                           , @CheckDate)
36            UNION ALL
37            SELECT    
38                        b.[ProductAssemblyID]
39                      , b.[ComponentID]
40                      , p.[Name]
41                      , b.[PerAssemblyQty]
42                      , p.[StandardCost]
43                      , p.[ListPrice]
44                      , b.[BOMLevel]
45                      , [RecursionLevel]+1 -- Join recursive member to anchor
46
47            FROM      
48                        [BOM_cte] cte
49            INNER JOIN  [Production].[BillOfMaterials] b
50            ON          cte.[ProductAssemblyID]=b.[ComponentID]
51            INNER JOIN  [Production].[Product] p
52            ON          b.[ProductAssemblyID]=p.[ProductID]
53            WHERE   
54                        @CheckDate>=b.[StartDate]
55                    AND @CheckDate<=ISNULL(  b.[EndDate]
56                                           , @CheckDate))
57    SELECT    
58                b.[ProductAssemblyID]
59              , b.[ComponentID]
60              , b.[ComponentDesc]
61              , sum(b.[PerAssemblyQty]) AS [TotalQuantity]
62              , b.[StandardCost]
63              , b.[ListPrice]
64              , b.[BOMLevel]
65              , b.[RecursionLevel]
66    FROM      
67                [BOM_cte] b
68    GROUP BY  
69                b.[ComponentID]
70              , b.[ComponentDesc]
71              , b.[ProductAssemblyID]
72              , b.[BOMLevel]
73              , b.[RecursionLevel]
74              , b.[StandardCost]
75              , b.[ListPrice]
76    ORDER BY  
77                b.[BOMLevel]
78              , b.[ProductAssemblyID]
79              , b.[ComponentID]
80    OPTION(  maxrecursion 25)
81END

Analysis Results

 MessageLineColumn
1SA0035 : TODO,HACK or UNDONE phrase found in a comment.74
2SA0035 : TODO,HACK or UNDONE phrase found in a comment.2526
See Also

Other Resources