Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 1.3 KB

File metadata and controls

49 lines (37 loc) · 1.3 KB

PH2114: Avoid empty statements

Property Value
Package Philips.CodeAnalysis.MaintainabilityAnalyzers
Diagnostic ID PH2114
Category Maintainability
Analyzer AvoidEmptyStatementBlocksAnalyzer
CodeFix Yes
Severity Error
Enabled By Default Yes

Introduction

Avoid empty statements. These can happen if 2 semicolons are directly after each other. The empty statement hurts the readability of the code.

How to solve

As this is usually just a mistake or merge artifact, its safe to remove. This is exactly what the CodeFixer does.

Example

Code that triggers a diagnostic:

class BadExample
{
    public int BadMethod()
    {
        return 0; ;
    }
}

And the replacement code:

class GoodExample
{
    public void GoodMethod()
    {
        return 0;
    }
}

Configuration

This analyzer does not offer any special configuration. The general ways of suppressing diagnostics apply.