Showing 279 of 850 total issues
Function testSimpleModifiers
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
Open
func testSimpleModifiers() {
var router = Router()
router.all("/:id?", handler: handler)
- 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
File RouterResponse.swift
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import KituraNet
import KituraTemplateEngine
import LoggerAPI
import Foundation
import KituraContracts
Function Menu
has 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Menu = function() {
"use strict";
function Menu(o, www) {
var that = this;
o = o || {};
Function Menu
has 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Menu = function() {
"use strict";
function Menu(o, www) {
var that = this;
o = o || {};
Function _
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var _ = function() {
"use strict";
return {
isMsie: function() {
return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false;
Function _
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var _ = function() {
"use strict";
return {
isMsie: function() {
return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false;
TestStaticFileServer
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
Open
final class TestStaticFileServer: KituraTest, KituraTestSuite {
static var allTests: [(String, (TestStaticFileServer) -> () throws -> Void)] {
return [
("testFileServer", testFileServer),
TestResponse
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
Open
final class TestResponse: KituraTest, KituraTestSuite {
static var allTests: [(String, (TestResponse) -> () throws -> Void)] {
return [
("testSimpleResponse", testSimpleResponse),
File TestTemplateEngine.swift
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import XCTest
import Foundation
import KituraTemplateEngine
import KituraContracts
TestTypeSafeMiddleware
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
Open
final class TestTypeSafeMiddleware: KituraTest, KituraTestSuite {
static var allTests: [(String, (TestTypeSafeMiddleware) -> () throws -> Void)] {
return [
("testSingleMiddlewareGetSingleton", testSingleMiddlewareGetSingleton),
("testMultipleMiddlewareGetSingleton", testMultipleMiddlewareGetSingleton),
File TestRequests.swift
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import XCTest
import Foundation
import KituraContracts
@testable import Kitura
Function testSend
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
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))")
Function addCookie
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
Open
public func addCookie(name: String, value: String, domain: String, path: String, otherAttributes: [AdditionalCookieAttribute]? = nil ) {
var cookieProperties = [HTTPCookiePropertyKey: Any]()
cookieProperties[HTTPCookiePropertyKey.name] = name
cookieProperties[HTTPCookiePropertyKey.value] = value
cookieProperties[HTTPCookiePropertyKey.domain] = domain
- 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 testFileServer
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
func testFileServer() {
performServerTest(router, asyncTasks: { expectation in
self.performRequest("get", path:"/qwer", callback: {response in
XCTAssertNotNil(response, "ERROR!!! ClientRequest response object was nil")
XCTAssertEqual(response?.statusCode, HTTPStatusCode.OK, "HTTP Status code was \(String(describing: response?.statusCode))")
Function testMultipartFormParsing
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
func testMultipartFormParsing() {
// ensure NSData.components works just like String.components
dataComponentsTest("AxAyAzA", separator: "A")
dataComponentsTest("HelloWorld", separator: "World")
Function WWW
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var WWW = function() {
"use strict";
var defaultClassNames = {
wrapper: "twitter-typeahead",
input: "tt-input",
Function WWW
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var WWW = function() {
"use strict";
var defaultClassNames = {
wrapper: "twitter-typeahead",
input: "tt-input",
Function testSimplePaths
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
func testSimplePaths() {
var router = Router()
router.all("", handler: handler)
Function EventEmitter
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var EventEmitter = function() {
"use strict";
var splitter = /\s+/, nextTick = getNextTick();
return {
onSync: onSync,
Function EventEmitter
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var EventEmitter = function() {
"use strict";
var splitter = /\s+/, nextTick = getNextTick();
return {
onSync: onSync,