google/EarlGrey

View on GitHub

Showing 9 of 50 total issues

Method copy_swift_files has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def copy_swift_files(project, target, swift_version = nil)
      return unless has_swift?(target) || !swift_version.to_s.empty?
      project_test_targets = project.main_group.children
      test_target_group = project_test_targets.find { |g| g.display_name == target.name }

Severity: Minor
Found in gem/lib/earlgrey/configure_earlgrey.rb - About 2 hrs 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 viewDidLoad has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  override func viewDidLoad() {
    super.viewDidLoad()

    // Create the send message view to contain one of the two send buttons
    let sendMessageView = SendMessageView(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
Severity: Minor
Found in Demo/EarlGreyExample/EarlGreyExampleSwift/ViewController.swift - About 1 hr to fix

    Method copy_swift_files has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def copy_swift_files(project, target, swift_version = nil)
          return unless has_swift?(target) || !swift_version.to_s.empty?
          project_test_targets = project.main_group.children
          test_target_group = project_test_targets.find { |g| g.display_name == target.name }
    
    
    Severity: Minor
    Found in gem/lib/earlgrey/configure_earlgrey.rb - About 1 hr to fix

      Function testCustomAction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        func testCustomAction() {
          // Fade in and out an element.
          let fadeInAndOut = { (element: UIView) -> Void in
            UIView.animate(withDuration: 1.0, delay: 0.0,
                           options: UIViewAnimationOptions.curveEaseOut,

        Method add_environment_variables_to_test_scheme has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def add_environment_variables_to_test_scheme(name, scheme)
              name = File.basename(name, '.xcscheme')
              test_action = scheme.test_action
              test_variables = test_action.environment_variables
        
        
        Severity: Minor
        Found in gem/lib/earlgrey/configure_earlgrey.rb - About 1 hr to fix

          Method analyze has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def analyze(*_)
                result = super
                earlgrey_yaml = EarlGreyYaml.new(result, podfile)
                eg_targets = result.targets.select(&:is_earlgrey?).each do |target|
                  target.user_targets.each do |native_target|
          Severity: Minor
          Found in gem/lib/earlgrey/extensions/analyzer_extensions.rb - About 55 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 _ChangeFrameworkTextInFiles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def _ChangeFrameworkTextInFiles():
            """Change instances of OCHamcrestIOS to OCHamcrest."""
            abs_path = _FilePathRelativeToScriptDirectory('OCHamcrest.framework')
            for dname, _, files in os.walk(abs_path):
              for fname in files:
          Severity: Minor
          Found in Scripts/rename-ochamcrestIOS.py - 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 testWithCustomMatcher has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            func testWithCustomMatcher() {
              // Define the match condition: matches table cells that contains a date for a Thursday.
              let matches: MatchesBlock = { (element: Any?) -> Bool in
                if let cell = element as? UITableViewCell {
                  let formatter = DateFormatter()

          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

          Method add_carthage_search_paths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def add_carthage_search_paths(target)
                target.build_configurations.each do |config|
                  settings = config.build_settings
                  settings[FRAMEWORK_SEARCH_PATHS] = Array(settings[FRAMEWORK_SEARCH_PATHS])
                  unless settings[FRAMEWORK_SEARCH_PATHS].include?(CARTHAGE_BUILD_IOS)
          Severity: Minor
          Found in gem/lib/earlgrey/configure_earlgrey.rb - About 25 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