Home
Redundant pairs of parentheses should be removed
Rule description
- Redundant pairs of parentheses should be removed
Non-compliant Code Example
DECLARE @Number int; SET @Number = 50; IF ((@Number > 100)) --Non compliant code (Conditional with redundant pairs of parentheses) PRINT 'The number is large.'; ELSE BEGIN IF ((@Number < 10) AND (@Number > 0)) --Non compliant code (Conditional with redundant pairs of parentheses) PRINT 'The number is small.'; ELSE PRINT 'The number is medium.'; END ; GO
Compliant Code Example
DECLARE @Number int; SET @Number = 50; IF (@Number > 100) --Compliant code (Conditional without redundant pairs of parentheses) PRINT 'The number is large.'; ELSE BEGIN IF (@Number < 10) AND (@Number > 0) --Compliant code (Conditional without redundant pairs of parentheses) PRINT 'The number is small.'; ELSE PRINT 'The number is medium.'; END ; GO