Query module ConstantCondition

name
Constant condition
description
A condition that always evaluates to ‘true’ or always evaluates to ‘false’ should be removed, and if the condition is a loop condition, the condition is likely to cause an infinite loop.
kind
problem
problem.severity
warning
precision
very-high
id
cs/constant-condition
tags
maintainability readability external/cwe/cwe-835

Imports

Assertions

Provides classes for assertions.

Constants

Provides logic for determining constant expressions.

csharp

The default C# QL library.

Classes

ConstantBooleanCondition

A constant Boolean condition.

ConstantCondition

A constant condition.

ConstantIfCondition

A constant condition in an if statement or a conditional expression.

ConstantLoopCondition

A constant loop condition.

ConstantMatchingCondition

A constant matching condition.

ConstantNullnessCondition

A constant nullness condition.