google/EarlGrey

View on GitHub
gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift

Summary

Maintainability
D
1 day
Test Coverage

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

  @discardableResult open class func rotateDeviceTo(orientation: UIDeviceOrientation,
                                                    errorOrNil: UnsafeMutablePointer<NSError?>!,
                                                    file: StaticString = #file,
                                                    line: UInt = #line)
    -> Bool {
Severity: Major
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 1 hr to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 124..132

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 85.

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 2 locations. Consider refactoring.
Open

extension GREYCondition {
  open func waitWithTimeout(seconds: CFTimeInterval) -> Bool {
    return self.wait(withTimeout: seconds)
  }

Severity: Major
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 1 hr to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 151..160

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 76.

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 4 locations. Consider refactoring.
Open

public func GREYAssertEqualObjects<T: Equatable>( _ left: @autoclosure () -> T?,
                                                  _ right: @autoclosure () -> T?,
                                                  reason: String) {
  GREYAssert(left() == right(), reason, details: "Expected object of the left term to be equal " +
    "to the object of the right term")
Severity: Major
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 3 other locations - About 1 hr to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 50..55
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 57..62
gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift on lines 57..62

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 74.

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 2 locations. Consider refactoring.
Open

private func GREYSetCurrentAsFailable() {
  let greyFailureHandlerSelector =
    #selector(GREYFailureHandler.setInvocationFile(_:andInvocationLine:))
  let greyFailureHandler =
    Thread.current.threadDictionary.value(forKey: kGREYFailureHandlerKey) as! GREYFailureHandler
Severity: Major
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 1 hr to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 87..95

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 74.

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 4 locations. Consider refactoring.
Open

public func GREYAssertNotEqualObjects<T: Equatable>( _ left: @autoclosure () -> T?,
                                                     _ right: @autoclosure () -> T?,
                                                     reason: String) {
  GREYAssert(left() != right(), reason, details: "Expected object of the left term to not " +
    "equal the object of the right term")
Severity: Major
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 3 other locations - About 1 hr to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 50..55
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 57..62
gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift on lines 50..55

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 74.

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 2 locations. Consider refactoring.
Open

private func GREYAssert(_ expression: @autoclosure () -> Bool,
                        _ reason: String, details: String) {
  GREYSetCurrentAsFailable()
  GREYWaitUntilIdle()
  if !expression() {
Severity: Major
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 1 hr to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 76..85

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 72.

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

  open class func handle(exception: GREYFrameworkException,
                         details: String,
                         file: StaticString = #file,
                         line: UInt = #line) {
    return EarlGreyImpl.invoked(fromFile: file.description, lineNumber: line)
Severity: Minor
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 55 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 116..122

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 67.

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

  public static func selectElement(with matcher: GREYMatcher,
                                   file: StaticString = #file,
                                   line: UInt = #line) -> GREYInteraction {
    return EarlGreyImpl.invoked(fromFile: file.description, lineNumber: line)
      .selectElement(with: matcher)
Severity: Minor
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 55 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 102..107

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 63.

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 4 locations. Consider refactoring.
Open

public func GREYAssertEqual(_ left: @autoclosure () -> AnyObject?,
                            _ right: @autoclosure () -> AnyObject?, reason: String) {
  GREYAssert(left() === right(), reason, details: "Expected left term to be equal to right term")
}
Severity: Major
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 3 other locations - About 50 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 40..43
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 45..48
gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift on lines 45..48

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 62.

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 4 locations. Consider refactoring.
Open

public func GREYAssertNotEqual(_ left: @autoclosure () -> AnyObject?,
                               _ right: @autoclosure () -> AnyObject?, reason: String) {
  GREYAssert(left() !== right(), reason, details: "Expected left term to not equal the right term")
}
Severity: Major
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 3 other locations - About 50 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 40..43
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 45..48
gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift on lines 40..43

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 62.

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

  open class func setFailureHandler(handler: GREYFailureHandler,
                                    file: StaticString = #file,
                                    line: UInt = #line) {
    return EarlGreyImpl.invoked(fromFile: file.description, lineNumber: line)
      .setFailureHandler(handler)
Severity: Minor
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 45 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 109..114

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 57.

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

  @discardableResult public func assert(_ matcher: @autoclosure () -> GREYMatcher,
                                        error:UnsafeMutablePointer<NSError?>!) -> Self {
    return self.__assert(with: matcher(), error: error)
  }
Severity: Minor
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 45 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 140..143

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 56.

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 4 locations. Consider refactoring.
Open

public func GREYAssertNil(_ expression: @autoclosure () -> Any?, reason: String) {
  GREYAssert(expression() == nil, reason, details: "Expected expression to be nil")
}
Severity: Major
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 3 other locations - About 35 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 32..34
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 36..38
gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift on lines 32..34

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 45.

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 4 locations. Consider refactoring.
Open

public func GREYAssertNotNil(_ expression: @autoclosure ()-> Any?, reason: String) {
  GREYAssert(expression() != nil, reason, details: "Expected expression to be not nil")
}
Severity: Major
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 3 other locations - About 35 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 32..34
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 36..38
gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift on lines 36..38

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 45.

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 2 locations. Consider refactoring.
Open

public func GREYFailWithDetails(_ reason: String, details: String) {
  EarlGrey.handle(exception: GREYFrameworkException(name: kGREYAssertionFailedException,
                                                    reason: reason),
                  details: details)
}
Severity: Minor
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 35 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 70..74

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 43.

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 2 locations. Consider refactoring.
Open

public func GREYAssertFalse(_ expression: @autoclosure () -> Bool, reason: String) {
  GREYAssert(!expression(), reason, details: "Expected the boolean expression to be false")
}
Severity: Minor
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 35 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 28..30

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 43.

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 3 locations. Consider refactoring.
Open

public func GREYAssert(_ expression: @autoclosure () -> Bool, reason: String) {
  GREYAssert(expression(), reason, details: "Expected expression to be true")
}
Severity: Minor
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 2 other locations - About 30 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 24..26
gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift on lines 24..26

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 41.

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 3 locations. Consider refactoring.
Open

public func GREYAssertTrue(_ expression: @autoclosure () -> Bool, reason: String) {
  GREYAssert(expression(), reason, details: "Expected the boolean expression to be true")
}
Severity: Minor
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 2 other locations - About 30 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 24..26
gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift on lines 20..22

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 41.

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 2 locations. Consider refactoring.
Open

  @discardableResult public func using(searchAction: GREYAction,
                                       onElementWithMatcher matcher: GREYMatcher) -> Self {
    return self.usingSearch(searchAction, onElementWith: matcher)
  }
Severity: Minor
Found in gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift and 1 other location - About 30 mins to fix
gem/lib/earlgrey/files/Swift-3.0/EarlGrey.swift on lines 145..148

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 40.

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

There are no issues that match your filters.

Category
Status