sabirvirtuoso/Mockit

View on GitHub

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
Severity: Major
Found in Example/Tests/MockMatcherTests.swift - About 1 day to fix

    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
    Severity: Major
    Found in Example/Tests/StubTests.swift - About 1 day to fix

      File CallHandlerTests.swift has 370 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import XCTest
      import Mockit
      
      
      // MARK:- An implementation of `Mock` protocol
      Severity: Minor
      Found in Example/Tests/CallHandlerTests.swift - About 4 hrs to fix

        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
        Severity: Minor
        Found in Example/Tests/VerificationModeTests.swift - About 3 hrs to fix

          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>):
          Severity: Minor
          Found in Mockit/Classes/TypeMatcher.swift - About 1 hr to fix

          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?>):
          Severity: Minor
          Found in Mockit/Classes/TypeMatcher.swift - About 1 hr to fix

          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 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>):
          Severity: Minor
          Found in Mockit/Classes/TypeMatcher.swift - About 1 hr to fix

            Function testCallingStubMultipleTimesWithSuccessfulArgumentMatchingThenDoCorrespondingActions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              func testCallingStubMultipleTimesWithSuccessfulArgumentMatchingThenDoCorrespondingActions() {
                // Given
                let sut = stub
            
                let functionName = "func"
            Severity: Minor
            Found in Example/Tests/StubTests.swift - About 1 hr to fix

              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?>):
              Severity: Minor
              Found in Mockit/Classes/TypeMatcher.swift - About 1 hr to fix

                Function testCallingStubMultipleTimesWithSuccessfulArgumentMatchingInSomeCallsThenDoLastActionForNonCorrespondingCalls has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  func testCallingStubMultipleTimesWithSuccessfulArgumentMatchingInSomeCallsThenDoLastActionForNonCorrespondingCalls() {
                    // Given
                    let sut = stub
                
                    let functionName = "func"
                Severity: Minor
                Found in Example/Tests/StubTests.swift - About 1 hr to fix

                  Function testCallingStubByChainingDifferentActionablesIncludingMultipleThenReturn has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    func testCallingStubByChainingDifferentActionablesIncludingMultipleThenReturn() {
                      // Given
                      let sut = stub
                  
                      let functionName = "func"
                  Severity: Minor
                  Found in Example/Tests/StubTests.swift - About 1 hr to fix

                    Function testCallingStubMultipleTimesWithSuccessfulArgumentMatchingInSomeCallsThenDoCorrespondingActions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      func testCallingStubMultipleTimesWithSuccessfulArgumentMatchingInSomeCallsThenDoCorrespondingActions() {
                        // Given
                        let sut = stub
                    
                        let functionName = "func"
                    Severity: Minor
                    Found in Example/Tests/StubTests.swift - About 1 hr to fix

                      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? {
                      Severity: Minor
                      Found in Example/Tests/MockTests.swift - About 35 mins to fix

                        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? {
                        Severity: Minor
                        Found in Mockit/Classes/CallHandlerImpl.swift - About 35 mins to fix

                          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?>):
                          Severity: Minor
                          Found in Mockit/Classes/TypeMatcher.swift - About 35 mins to fix

                          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>):
                          Severity: Minor
                          Found in Mockit/Classes/TypeMatcher.swift - About 35 mins to fix

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language