Showing 279 of 850 total issues
Function highlight
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
var highlight = function(doc) {
"use strict";
var defaults = {
node: null,
pattern: null,
Function highlight
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
var highlight = function(doc) {
"use strict";
var defaults = {
node: null,
pattern: null,
File TestRouterHTTPVerbs_generated.swift
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
import XCTest
import Foundation
@testable import Kitura
@testable import KituraNet
Function testCustomQueryEncoder
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testCustomQueryEncoder() {
// Set up router for this test
let customRouter = Router()
customRouter.encoders[.urlEncoded] = { return QueryEncoder() }
File KituraTest.swift
has 299 lines of code (exceeds 250 allowed). Consider refactoring. Open
import XCTest
import Kitura
@testable import KituraNet
Function cookieFrom
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
func cookieFrom(response: ClientResponse?, named: String) -> (HTTPCookie?, String?) {
guard let response = response else {
return (nil, nil)
}
var resultCookie: HTTPCookie? = nil
- 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 testSimpleMatches
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testSimpleMatches() {
var router = Router()
router.all("/test", handler: handler)
TestTemplateEngine
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
final class TestTemplateEngine: KituraTest, KituraTestSuite {
static var allTests: [(String, (TestTemplateEngine) -> () throws -> Void)] {
return [
("testEmptyTemplateName", testEmptyTemplateName),
Function testQueryParameters
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testQueryParameters() {
// Set up router for this test
let router = Router()
struct Params: QueryParams {
Function testSend
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
func testSend() {
performServerTest(router) { expectation in
self.performRequest("get", path: "/data", callback: { response in
XCTAssertNotNil(response, "ERROR!!! ClientRequest response object was nil")
XCTAssertEqual(response?.statusCode, HTTPStatusCode.OK, "HTTP Status code was \(String(describing: response?.statusCode))")
- 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 testCookieFromServer
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testCookieFromServer() {
performServerTest(router, asyncTasks: { expectation in
self.performRequest("get", path: "/1/sendcookie", callback: {response in
XCTAssertEqual(response?.statusCode, HTTPStatusCode.OK, "/1/sendcookie route did not match single path request")
Function testCustomQueryEncoder
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
func testCustomQueryEncoder() {
// Set up router for this test
let customRouter = Router()
customRouter.encoders[.urlEncoded] = { return QueryEncoder() }
- 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 testQueryParameters
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
func testQueryParameters() {
// Set up router for this test
let router = Router()
struct Params: QueryParams {
- 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 testFourthTypeVerbsAdded
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testFourthTypeVerbsAdded() {
let router = Router()
var verbsArray: [String] = []
let bodyParser = BodyParser()
verbsArray.append("ALL")
File TestCookies.swift
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
import XCTest
import Foundation
#if swift(>=4.1)
#if canImport(FoundationNetworking)
import FoundationNetworking
Function testThirdTypeVerbsAdded
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testThirdTypeVerbsAdded() {
let router = Router()
var verbsArray: [String] = []
let bodyParser = BodyParser()
verbsArray.append("ALL")
Function testSecondTypeVerbsAdded
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testSecondTypeVerbsAdded() {
let router = Router()
var verbsArray: [String] = []
verbsArray.append("ALL")
router.all("/bodytest", handler: [self.bodyTestHandler, self.bodyTestHandler])
Function testFirstTypeVerbsAdded
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testFirstTypeVerbsAdded() {
let router = Router()
var verbsArray: [String] = []
verbsArray.append("ALL")
router.all("/bodytest", handler: self.bodyTestHandler)
ServerTestBuilder
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ServerTestBuilder: RequestTestBuilder, AssertionTestBuilder {
// An object to keep track of a request and store up a list of
// assertions to be applied when the request is complete
private class Request {
let test: KituraTest
Function parse
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
static func parse(size: UInt64, headerValue: String, shouldCombine: Bool = true) throws -> RangeHeader {
guard let index = headerValue.range(of: "=")?.lowerBound else {
// malformed
throw RangeHeader.Error.malformed
- 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"