V7009. Parameter is not used in a function, constructor, or method.
The analyzer has detected a suspicious function, constructor, or method where one of the parameters is never used. However, another parameter is used multiple times, which may indicate an error.
The example:
function cardHasLock(width, height) {
const X_SCALE = 0.051;
const Y_SCALE = 0.0278;
const lockWidth = Math.round(height * X_SCALE); // <=
const lockHeight = Math.round(height * Y_SCALE);
}
The width parameter is never used in the body of the function, while the height parameter is used twice, including when the lockWidth constant is initialized. This behavior is erroneous.
The fixed code for initializing the lockWidth constant:
const lockWidth = Math.round(width * X_SCALE);
If a parameter is not being used on purpose, either replace its name with _ or add _ as the first character of its name. This is a common practice among developers to indicate that a parameter is not used:
function handler(_, res) {
res.status(200);
res.send("ok");
}