Showing 7 of 7 total issues
Function MithrilRouter
has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring. Open
Open
})(function MithrilRouter (m) {
// Mithril is already patched, exit to avoid infinite recursion
if (m._route) {
return m
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function MithrilRouter
has 172 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
})(function MithrilRouter (m) {
// Mithril is already patched, exit to avoid infinite recursion
if (m._route) {
return m
}
Consider simplifying this complex logical expression. Open
Open
if (arguments.length === 2 && typeof arguments[0] === 'string' && (typeof arguments[1] === 'object' || typeof arguments[1] === 'boolean' || typeof arguments[1] === 'undefined')) {
return m._route(m.routes[arguments[0]] || arguments[0], arguments[1])
}
Consider simplifying this complex logical expression. Open
Open
if (arguments.length === 3 && typeof arguments[0] === 'string' && (typeof arguments[1] === 'object' || typeof arguments[1] === 'undefined') && typeof arguments[2] === 'boolean') {
return m._route(m.routes[arguments[0]] || arguments[0], arguments[1], arguments[2])
}
Avoid too many return
statements within this function. Open
Open
return m.route._config(arguments[0], arguments[1])
Avoid too many return
statements within this function. Open
Open
return m.route._config(arguments[0], arguments[2], arguments[1])
Avoid too many return
statements within this function. Open
Open
return m._route.call(this, arguments[0], arguments[1], arguments[2], arguments[3])