Edit me

The empty-blocks ruleset contains rules that will report empty blocks of code which should be avoided.

EmptyCatchBlock

Reports empty catch blocks. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

Configuration options:

  • allowedExceptionNameRegex (default: "^(_|(ignore|expected).*)")

    ignores exception types which match this regex

EmptyClassBlock

Reports empty classes. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptyDefaultConstructor

Reports empty default constructors. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptyDoWhileBlock

Reports empty do/while loops. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptyElseBlock

Reports empty else blocks. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptyFinallyBlock

Reports empty finally blocks. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptyForBlock

Reports empty for loops. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptyFunctionBlock

Reports empty functions. Empty blocks of code serve no purpose and should be removed. This rule will not report functions with the override modifier that have a comment as their only body contents (e.g., a // no-op comment in an unused listener function).

Set the [ignoreOverriddenFunctions] parameter to true to exclude all functions which are overriding other functions from the superclass or from an interface (i.e., functions declared with the override modifier).

Severity: Minor

Debt: 5min

Configuration options:

  • ignoreOverriddenFunctions (default: false)

    Excludes all the overridden functions

EmptyIfBlock

Reports empty if blocks. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptyInitBlock

Reports empty init expressions. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptyKtFile

Reports empty Kotlin (.kt) files. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptySecondaryConstructor

Reports empty secondary constructors. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptyWhenBlock

Reports empty when expressions. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min

EmptyWhileBlock

Reports empty while expressions. Empty blocks of code serve no purpose and should be removed.

Severity: Minor

Debt: 5min