Showing 19 of 77 total issues
Method resolveTargetRoute
has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring. Open
/**
* Method used for route resolution
* @param method HTTP method of the request
* @param target Target resource
* @return route required to handle HTTP request
- 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
Class AppRouter
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
/**
* @author Iyanu Adelekan on 16/08/2018.
*
* Core application router class. Utilize instances of this class
* to compose server routes. Upon composition of a route it must be
Method fetchUserFeed
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun fetchUserFeed(baseRequest: Request, request: HttpServletRequest, response: HttpServletResponse) {
// Create json object mapper
val mapper = ObjectMapper()
val responseRootNode = mapper.createObjectNode()
Class Router
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
/**
* @author Iyanu Adelekan on 16/08/2018.
*
* Interface defining methods that must be implemented by an application router.
*/
Method addRoute
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
/**
* Invoked to register a new route to the router.
*
* @param routeType - type of route to be added. See [RouteType].
* @param path - URL path.
- 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
Method userSignUp
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun userSignUp(baseRequest: Request, request: HttpServletRequest, response: HttpServletResponse) {
// Create json object mapper
val mapper = ObjectMapper()
val responseRootNode = mapper.createObjectNode()
Method resolveTargetRoute
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* Method used for route resolution
* @param method HTTP method of the request
* @param target Target resource
* @return route required to handle HTTP request
Method userSignUp
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
fun userSignUp(baseRequest: Request, request: HttpServletRequest, response: HttpServletResponse) {
// Create json object mapper
val mapper = ObjectMapper()
val responseRootNode = mapper.createObjectNode()
- 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
Method fetchFeed
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun fetchFeed(baseRequest: Request, request: HttpServletRequest, response: HttpServletResponse) {
// Create json object mapper
val mapper = ObjectMapper()
val responseRootNode = mapper.createObjectNode()
Method createCweet
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun createCweet(baseRequest: Request, request: HttpServletRequest, response: HttpServletResponse) {
// Create json object mapper
val mapper = ObjectMapper()
val responseRootNode = mapper.createObjectNode()
Method userSignIn
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun userSignIn(baseRequest: Request, request: HttpServletRequest, response: HttpServletResponse) {
// Create json object mapper
val mapper = ObjectMapper()
val responseRootNode = mapper.createObjectNode()
Method addRoute
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* Invoked to register a new route to the router.
*
* @param routeType - type of route to be added. See [RouteType].
* @param path - URL path.
Method fetchUserFeed
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
fun fetchUserFeed(baseRequest: Request, request: HttpServletRequest, response: HttpServletResponse) {
// Create json object mapper
val mapper = ObjectMapper()
val responseRootNode = mapper.createObjectNode()
- 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
Method handle
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* Handles server HTTP requests.
*
* @param path - request path.
* @param immutableRequest - immutable jetty specific request instance.
Method getRouteNode
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* Invoked to resolve a corresponding RouteNode to a given URL target - if any.
*
* @param path - URL path (target).
* @return [RouteNode] - Returns corresponding instance of [RouteNode], if one exists. Else returns null.
Avoid deeply nested control flow statements. Open
if (i == subPaths.size - 1) {
childNode.action = action
}
Avoid deeply nested control flow statements. Open
if (middleware != null) {
childNode.addMiddleware(middleware)
}
Method sendMail
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
title: String,
subject: String,
body: String,
sender: String,
receiver: String): Any
Method getRouteNode
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
/**
* Invoked to resolve a corresponding RouteNode to a given URL target - if any.
*
* @param path - URL path (target).
* @return [RouteNode] - Returns corresponding instance of [RouteNode], if one exists. Else returns null.
- 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"