SA0177 : To improve code readability, put only one statement per line

The topic describes the SA0177 analysis rule.

Message

To improve code readability, put only one statement per line

Description

The rule checks for more than one statement placed on one and the same line.

The code should be reformatted to have a single statement per line.

How to fix

Place the start of each statement on own line.

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.

Effort To Fix
2 minutes per issue.
Categories

Design Rules, Code Smells

Additional Information

There is no additional info for this rule.

Example Test SQL
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) SELECT 'Hello!' UNION ALL SELECT 'Hi!' UNION ALL SELECT 'Hello, world!'
 8
 9INSERT INTO Test.Greeting (Message) 
10VALUES ('How do yo do?'),
11        ('Good morning!'),
12        ('Good night!')  SELECT * FROM Test.Greeting g 
13WHERE 
14g.Message like 'Hello%'
15
16DELETE  Test.Greeting WHERE GreetingId = 3;  DROP TABLE Test.Greeting

Analysis Results
  Message Line Column
1 SA0177 : To improve code readability, put only one statement per line. 16 0
2 SA0177 : To improve code readability, put only one statement per line. 16 45
See Also

Other Resources