Block of commented-out source code

ID

scala.maintainability.commented_out_code

Severity

info

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Dead Code

Language

Scala

Description

This comment holds commented-out code rather than an explanation. Version control already keeps the history, so delete it - stale commented-out code misleads readers about what the file does.

Rationale

This comment holds commented-out code rather than an explanation. Version control already keeps the history, so delete it - stale commented-out code misleads readers about what the file does.

The following code illustrates the pattern detected by this rule:

class CommentedOutCode {
  // FLAGGED: Block of commented-out source code
  // val abandoned = compute(1, 2)

  // FLAGGED: Block of commented-out source code
  // Returns the compensated total for the current period.
  def total(a: Int, b: Int): Int = a + b
}

Remediation

Follow secure coding practices and review the references below for detailed remediation guidance.

Configuration

This detector does not need any configuration.

© 2026 Xygeni. All rights reserved