sabirvirtuoso/Mockit

View on GitHub

Showing 148 of 148 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

extension MockMatcherTests {

  func testEmptyOptionalDictionaryWithStringKeysArgumentsMatch() {
    // Given
    let firstArgument: [String: Any?] = [:]
Severity: Major
Found in Example/Tests/MockMatcherTests.swift and 1 other location - About 4 days to fix
Example/Tests/MockMatcherTests.swift on lines 1498..1724

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 1943.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

extension MockMatcherTests {

  func testEmptyOptionalDictionaryWithIntKeysArgumentsMatch() {
    // Given
    let firstArgument: [Int: Any?] = [:]
Severity: Major
Found in Example/Tests/MockMatcherTests.swift and 1 other location - About 4 days to fix
Example/Tests/MockMatcherTests.swift on lines 1266..1492

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 1943.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

extension MockMatcherTests {

  func testEmptyDictionaryWithStringKeysArgumentsMatch() {
    // Given
    let firstArgument: [String: Any] = [:]
Severity: Major
Found in Example/Tests/MockMatcherTests.swift and 1 other location - About 3 days to fix
Example/Tests/MockMatcherTests.swift on lines 1034..1260

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 1489.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

extension MockMatcherTests {

  func testEmptyDictionaryWithIntKeysArgumentsMatch() {
    // Given
    let firstArgument: [Int: Any] = [:]
Severity: Major
Found in Example/Tests/MockMatcherTests.swift and 1 other location - About 3 days to fix
Example/Tests/MockMatcherTests.swift on lines 802..1028

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 1489.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          func testGetArgsReturnsCorrectNonNilArgumentsWhenMethodIsCalledMultipleTimes() {
            // Given
            let _ = mockImplementation.doSomethingWithNonOptionalArguments("one", arg2: 2)
            let _ = mockImplementation.doSomethingWithNonOptionalArguments("two", arg2: 3)
        
        
        Severity: Major
        Found in Example/Tests/CallHandlerTests.swift and 1 other location - About 3 hrs to fix
        Example/Tests/CallHandlerTests.swift on lines 654..669

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 214.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          func testGetArgsReturnsCorrectNonNilArgumentsWhenMultipleMethodsAreCalled() {
            // Given
            let _ = mockImplementation.doSomethingWithNonOptionalArguments("one", arg2: 2)
            let _ = mockImplementation.doSomethingWithSomeOptionalArguments("two", arg2: 4)
        
        
        Severity: Major
        Found in Example/Tests/CallHandlerTests.swift and 1 other location - About 3 hrs to fix
        Example/Tests/CallHandlerTests.swift on lines 637..652

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 214.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        class TestMockImplementation: Mock {
        
          var callHandler: CallHandler
        
          init(withCallHandler callHandler: CallHandler) {
        Severity: Major
        Found in Example/Tests/MockTests.swift and 1 other location - About 3 hrs to fix
        Example/Tests/CallHandlerTests.swift on lines 32..56

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 196.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        class MockImplementation: Mock {
        
          var callHandler: CallHandler
        
          init(withCallHandler callHandler: CallHandler) {
        Severity: Major
        Found in Example/Tests/CallHandlerTests.swift and 1 other location - About 3 hrs to fix
        Example/Tests/MockTests.swift on lines 87..111

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 196.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            func testVerificationModeAtMostTimesFailsWhenMethodIsCalledMoreThanGivenTimes() {
              // Given
              XCTAssertNil(failer.message)
              XCTAssertNil(failer.file)
              XCTAssertNil(failer.line)
          Severity: Major
          Found in Example/Tests/CallHandlerTests.swift and 1 other location - About 2 hrs to fix
          Example/Tests/CallHandlerTests.swift on lines 399..416

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 156.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            func testVerificationModeAtLeastTimesSucceedsWhenMethodIsCalledMoreThanGivenTimes() {
              // Given
              XCTAssertNil(failer.message)
              XCTAssertNil(failer.file)
              XCTAssertNil(failer.line)
          Severity: Major
          Found in Example/Tests/CallHandlerTests.swift and 1 other location - About 2 hrs to fix
          Example/Tests/CallHandlerTests.swift on lines 453..470

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 156.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

              let actionable = sut?.call(withReturnValue: dummyReturnValue).thenAnswer {
                (args: [Any?]) -> Int in
          
                return (args[0] as! Int) * 2
              }.thenAnswer {
          Severity: Major
          Found in Example/Tests/StubTests.swift and 2 other locations - About 2 hrs to fix
          Example/Tests/StubTests.swift on lines 710..722
          Example/Tests/StubTests.swift on lines 749..761

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 155.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

              let actionable = sut?.call(withReturnValue: dummyReturnValue).thenAnswer {
                (args: [Any?]) -> Int in
          
                return (args[0] as! Int) * 2
              }.thenAnswer {
          Severity: Major
          Found in Example/Tests/StubTests.swift and 2 other locations - About 2 hrs to fix
          Example/Tests/StubTests.swift on lines 710..722
          Example/Tests/StubTests.swift on lines 786..798

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 155.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

              let actionable = sut?.call(withReturnValue: dummyReturnValue).thenAnswer {
                (args: [Any?]) -> Int in
          
                return (args[0] as! Int) * 2
              }.thenAnswer {
          Severity: Major
          Found in Example/Tests/StubTests.swift and 2 other locations - About 2 hrs to fix
          Example/Tests/StubTests.swift on lines 749..761
          Example/Tests/StubTests.swift on lines 786..798

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 155.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            func testCallMatchesStubRegistrationWithAnythingAsNonOptionalArgumentMatcher() {
              // Given
              let sut = stub
          
              let functionName = "func"
          Severity: Major
          Found in Example/Tests/StubTests.swift and 1 other location - About 2 hrs to fix
          Example/Tests/StubTests.swift on lines 208..224

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 154.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            func testCallDoesNotMatchStubRegistrationWithAnyValueAsActualArgAndExactAsArgumentMatcher() {
              // Given
              let sut = stub
          
              let functionName = "func"
          Severity: Major
          Found in Example/Tests/StubTests.swift and 1 other location - About 2 hrs to fix
          Example/Tests/StubTests.swift on lines 190..206

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 154.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            func testCallDoesNotMatchStubRegistrationWithAnythingAndExactAsNonOptionalArgumentMatcher() {
              // Given
              let sut = stub
          
              let functionName = "func"
          Severity: Major
          Found in Example/Tests/StubTests.swift and 1 other location - About 2 hrs to fix
          Example/Tests/StubTests.swift on lines 226..242

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 152.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language