R14WARNINGfunction

Rest Parameter Changed

Flags when a rest parameter is added or removed, changing how the function collects extra arguments.


Applies to

TypeScriptPythonGoJavaRust

Why it matters

Rest parameters (...args) change the argument collection behavior. Adding a rest parameter allows callers to pass unlimited args. Removing one breaks callers that pass extra args.

Example

Before (single param)
// logger.ts
export function log(message: string): void { ... }
After (rest param)
// logger.ts (WARNING)
export function log(...messages: string[]): void { ... }

What you see in the terminal

$ npx dg check

  [WARNING] log (signature_change)
  src/logger.ts:2
  Function now uses a rest parameter. Argument collection behavior changed.

How detection works

The classifier checks the rest flag on the last parameter of both signatures. If the rest status changes, the rule fires.

Real-world scenario

A logging function is updated to accept variadic arguments. Existing callers still work, but the behavior may differ if they were relying on the fixed arity.

Edge cases

  • Python's *args and **kwargs changes are captured
  • Go's variadic parameter (...Type) changes are captured