Unused parameters of local function should be removed

  • Code Quality
  • Low
  • No tags

This rule applies when parameters are specified but not used in the body of a locally declared function.

In general, function parameters could be part of an API contract that cannot be changed easily.

However, local functions do not have such restrictions because they are only used inside the declaring file. So, for code readability and maintainability, it is recommended to remove unused parameters of a local function and cleanup unnecessary code at call sites.

Also, it might be a mistake that a programmer forgets to use the specified parameters.


  1. Not applied for callback function.
  2. Not applied when the call sites of a function cannot be determined statically.
  3. Not applied when the call sites of a function may call other functions.
  4. Not applied if the function is empty or uses arguments variable.
  5. Not applied at test case code because unused parameters are usually harmless at tests. Currently, BDD, TDD and QUnit style test cases are recognized.

Noncompliant Code Example

View with compliant examples side by side
function foo(x) {
    function helper(width, height) { // UNUSED_PARAM alarm on 'width' because it is not used in the function body.
    let width = computeWidth(x);
    let height = computeHeight(x);
    helper(width, height);

Compliant Code Example

View with noncompliant examples side by side
function foo(x) {
    function helper(height) {
    let height = computeHeight(x);


This rule was introduced in DeepScan 1.30.0.

Was this documentation helpful?