SA0183 : The commented out code reduces readability and should be deleted |
![]() |
The topic describes the SA0183 analysis rule.

The commented out code reduces readability and should be deleted

The rule reports blocks of comments, which contain syntax valid T-SQL statements.
The commented blocks of code reduce readability and must be avoided.
Even a later reuse of code was intended, it is a bad practice to have a commented blocks of unused code.
The unused code should be deleted and when needed, it can be retrieved from source control history.

Delete the commented out code block.

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

Name | Description | Default Value |
---|---|---|
MinCommentedBlockLines |
The minimum number of lines a commented block, in order to be considered by the rule. |
2 |

The rule does not need Analysis Context or SQL Connection.


Design Rules, Code Smells

There is no additional info for this rule.

SQL
1CREATE TABLE Test.Greeting 2( 3GreetingId INT IDENTITY (1,1) PRIMARY KEY, 4Message nvarchar(255) NOT NULL, 5) 6 7INSERT INTO Test.Greeting (Message) 8SELECT 'Hello!' 9UNION ALL 10SELECT 'Hi!' 11UNION ALL 12SELECT 'Hello, world!' 13 -- DROP TABLE Test.Greeting 14INSERT INTO Test.Greeting (Message) 15VALUES ('How do yo do?'), 16 ('Good morning!'), -- 1 17--2 18--3 19/* 4 20 5 21 6 22 7 23 8 249*/ 25 26 27 ('Good night!') 28--Delete the steps from the Approval Policy 29DELETE Test.Greeting WHERE GreetingId = 3 30/* 31SELECT 1 * FROM1 zTest.Greeting g 32WHERE 33g.Message like 'Hello%' 34 35DROP TABLE Test.Greeting*/ 36 |

Message | Line | Column | |
---|---|---|---|
1 | SA0183 : The commented out code reduces readability and should be deleted. | 30 | 0 |
