Method name starts with an upper-case letter

ID

scala.maintainability.naming_method

Severity

info

Remediation Complexity

medium

Remediation Risk

low

Remediation Effort

low

Resource

Naming

Language

Scala

Description

Reports a def whose name begins with an upper-case letter, instead of the lowerCamelCase that Scala uses for methods and values. Symbolic operator names are unaffected.

Rationale

A capitalised name signals a type or a stable identifier to a Scala reader, so a capitalised method reads as something it is not. The confusion is not only stylistic: in a case pattern an upper-case identifier is treated as a reference to an existing binding rather than a new one, so mixing the conventions makes pattern matches harder to read correctly.

The following code illustrates the pattern detected by this rule:

class NamingMethod {
  // FLAGGED: Method name starts with an upper-case letter
  def ProcessOrder(id: Long): String = id.toString
}

Remediation

Rename the method to lowerCamelCase - ProcessOrder becomes processOrder - and let the IDE update the call sites. Reserve capitalised names for types, objects and constants.

Configuration

This detector does not need any configuration.

© 2026 Xygeni. All rights reserved