Refactoring code in src/middleware/user.js to reduce its Cognitive Complexity from 18 to the 15 allowed. Cognitive Complexity is a measure of how hard it is to understand the control flow of a unit of code. Code with high cognitive complexity is hard to read, understand, test, and modify. As a rule of thumb, high cognitive complexity is a sign that the code should be refactored into smaller, easier-to-manage pieces (sonarcloud link).
Refactoring code in src/middleware/user.js to reduce its Cognitive Complexity from 18 to the 15 allowed. Cognitive Complexity is a measure of how hard it is to understand the control flow of a unit of code. Code with high cognitive complexity is hard to read, understand, test, and modify. As a rule of thumb, high cognitive complexity is a sign that the code should be refactored into smaller, easier-to-manage pieces (sonarcloud link).