Showing 16 of 148 total issues
File MockMatcherTests.swift
has 829 lines of code (exceeds 250 allowed). Consider refactoring. Open
import XCTest
import Mockit
// MARK:- This class will match OK
File StubTests.swift
has 518 lines of code (exceeds 250 allowed). Consider refactoring. Open
import XCTest
import Mockit
// MARK:- Test cases for `Stub` registration and satisfaction during actual call
File CallHandlerTests.swift
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
import XCTest
import Mockit
// MARK:- An implementation of `Mock` protocol
File VerificationModeTests.swift
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
import XCTest
import Mockit
// MARK:- A test implementation of `MockFailer` protocol
Function match
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public func match(argument arg: Any, withArgument withArg: Any) -> Bool {
switch (arg, withArg) {
case (let firstArg as Dictionary<String, Any>, let secondArg as Dictionary<String, Any>):
return match(firstArg, withDictionary: secondArg)
case (let firstArg as Dictionary<String, String>, let secondArg as Dictionary<String, String>):
- 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 match
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public func match(argument arg: Any, withArgument withArg: Any) -> Bool {
switch (arg, withArg) {
case (let firstArg as Dictionary<String, Any?>, let secondArg as Dictionary<String, Any?>):
return match(firstArg, withDictionary: secondArg)
case (let firstArg as Dictionary<String, String?>, let secondArg as Dictionary<String, String?>):
- 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 testCallingStubMultipleTimesWithSuccessfulArgumentMatchingThenDoCorrespondingActions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testCallingStubMultipleTimesWithSuccessfulArgumentMatchingThenDoCorrespondingActions() {
// Given
let sut = stub
let functionName = "func"
Function match
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public func match(argument arg: Any, withArgument withArg: Any) -> Bool {
switch (arg, withArg) {
case (let firstArg as Dictionary<String, Any?>, let secondArg as Dictionary<String, Any?>):
return match(firstArg, withDictionary: secondArg)
case (let firstArg as Dictionary<String, String?>, let secondArg as Dictionary<String, String?>):
Function match
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public func match(argument arg: Any, withArgument withArg: Any) -> Bool {
switch (arg, withArg) {
case (let firstArg as Dictionary<String, Any>, let secondArg as Dictionary<String, Any>):
return match(firstArg, withDictionary: secondArg)
case (let firstArg as Dictionary<String, String>, let secondArg as Dictionary<String, String>):
Function testCallingStubMultipleTimesWithSuccessfulArgumentMatchingInSomeCallsThenDoLastActionForNonCorrespondingCalls
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testCallingStubMultipleTimesWithSuccessfulArgumentMatchingInSomeCallsThenDoLastActionForNonCorrespondingCalls() {
// Given
let sut = stub
let functionName = "func"
Function testCallingStubMultipleTimesWithSuccessfulArgumentMatchingInSomeCallsThenDoCorrespondingActions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testCallingStubMultipleTimesWithSuccessfulArgumentMatchingInSomeCallsThenDoCorrespondingActions() {
// Given
let sut = stub
let functionName = "func"
Function testCallingStubByChainingDifferentActionablesIncludingMultipleThenReturn
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
func testCallingStubByChainingDifferentActionablesIncludingMultipleThenReturn() {
// Given
let sut = stub
let functionName = "func"
Function accept
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
open func accept(_ returnValue: Any?, ofFunction function: String, atFile file: String,
inLine line: Int, withArgs args: Any?...) -> Any? {
Function accept
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func accept(_ returnValue: Any?, ofFunction function: String, atFile file: String,
inLine line: Int, withArgs args: Any?...) -> Any? {
Function match
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public func match(argument arg: Any, withArgument withArg: Any) -> Bool {
switch (arg, withArg) {
case (let firstArg as Array<Any?>, let secondArg as Array<Any?>):
return match(firstArg, withArray: secondArg)
case (let firstArg as Array<String?>, let secondArg as Array<String?>):
- 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 match
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public func match(argument arg: Any, withArgument withArg: Any) -> Bool {
switch (arg, withArg) {
case (let firstArg as Array<Any>, let secondArg as Array<Any>):
return match(firstArg, withArray: secondArg)
case (let firstArg as Array<String>, let secondArg as Array<String>):
- 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"