A line comment contains code that was switched off

tx0/csharp:commented-out-codestrictwarningmaintainability/dead-codedepth fastmaintainability

What it finds

Code left in comments is never compiled, so it goes stale while it suggests that it still matters; version control keeps old code better. The rule reports runs of // comments in which a line ends with ;, { or } and contains code punctuation, once per run. Documentation comments and comments with words such as "e.g." are left alone.

From the rule's source, commented_out_code.rs.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:commented-out-code" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:commented-out-code] reason="..."

tx0 explain tx0/csharp:commented-out-code shows the same in the terminal. Found a false positive? Report it.