Inclusive Class Definition

ID

java.inclusive_class

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming Convention

Language

Java

Tags

inclusive, naming

Description

Reports class, interface, enum and record declarations whose name contains a non-inclusive term such as blacklist/whitelist, master/slave, grandfather, dummy or sanity.

Rationale

Non-inclusive terms carry social and historical weight that has no technical value; replacing them with neutral, intent-carrying words (allowlist/denylist, primary/replica, legacy, stub, smoke) makes the code friendlier to contributors and more precise about what it actually describes. Most industry style guides (Android, Chromium, Kubernetes, Linux kernel) have deprecated these terms.

// Bad
class UserBlacklist { ... }
class MasterDatabase { ... }

// Good
class UserDenyList { ... }
class PrimaryDatabase { ... }

Remediation

Rename the type using a neutral equivalent. Common substitutions:

  • blacklistdenylist / blocklist

  • whitelistallowlist

  • masterprimary / leader / main

  • slavereplica / follower / secondary

  • grandfatherlegacy

  • dummystub / placeholder

  • sanity checksmoke test / check

Configuration

The list of non-inclusive terms is configurable via the terms property in the YAML configuration:

properties:
  terms:
    - blacklist
    - whitelist
    - master
    - slave
    - grandfather
    - dummy
    - sanity
    - your-custom-term