Rule S2301 states that “Methods should not contain selector parameters”
Main reason is “Developers calling the method won’t see the parameter name, only its value. They’ll be forced either to guess at the meaning or to take extra time to look the method up.”
As i agree with this in general, i do not think is is relevant in the following code where the issue is raised
app.get(‘/status’, (req, res) => {
authorizationService
.isAdminUser(req)
.then((isAdmin) => {
if (!isAdmin) authorizationService.handleUnauthorizedAccess(req, res);
else … ;
})
.catch((err) => {
logger.error('Error in GET /status' + err);
res.status(500).send();
})
});
In this case the function is an arrow function that is never call from outside .
Furthermore , if i understand well solving the issue would mean changing the return type of the isAdminUser to return an object containing the boolean ???
Thank you for the report. We agree, we shouldn’t raise on anonymous lambda functions passed as callbacks. These won’t be reused and called by anyone else. Hence, they shouldn’t fall under this rule. Here is the ticket to track the progress - Jira