CocoaPods/Xcodeproj

View on GitHub

Showing 72 of 74 total issues

Method parse has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.parse(flags)
        result = {
          :frameworks => [],
          :weak_frameworks => [],
          :libraries => [],
Severity: Minor
Found in lib/xcodeproj/config/other_linker_flags_parser.rb - About 1 hr to fix

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

            def add_system_framework(names)
              Array(names).map do |name|
                case platform_name
                when :ios
                  group = project.frameworks_group['iOS'] || project.frameworks_group.new_group('iOS')
    Severity: Minor
    Found in lib/xcodeproj/project/object/native_target.rb - About 1 hr to fix

      Method add_dependency has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

              def add_dependency(target)
                unless dependency_for_target(target)
                  container_proxy = project.new(Xcodeproj::Project::PBXContainerItemProxy)
                  if target.project == project
                    container_proxy.container_portal = project.root_object.uuid
      Severity: Minor
      Found in lib/xcodeproj/project/object/native_target.rb - 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

      Method sort_by_type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

              def sort_by_type
                children.sort! do |x, y|
                  if x.isa == 'PBXGroup' && !(y.isa == 'PBXGroup')
                    -1
                  elsif !(x.isa == 'PBXGroup') && y.isa == 'PBXGroup'
      Severity: Minor
      Found in lib/xcodeproj/project/object/group.rb - 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

      Method set_path_with_source_tree has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

                def set_path_with_source_tree(object, path, source_tree)
                  path = Pathname(path)
                  source_tree = normalize_source_tree(source_tree)
                  object.source_tree = source_tree
      
      
      Severity: Minor
      Found in lib/xcodeproj/project/object/helpers/groupable_helper.rb - 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

      Method common_build_settings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.common_build_settings(type, platform = nil, deployment_target = nil, target_product_type = nil, language = :objc)
              target_product_type = (Constants::PRODUCT_TYPE_UTI.find { |_, v| v == target_product_type } || [target_product_type || :application])[0]
              common_settings = Constants::COMMON_BUILD_SETTINGS
      
              # Use intersecting settings for all key sets as base
      Severity: Minor
      Found in lib/xcodeproj/project/project_helper.rb - 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

      Method fixup_uuid_references has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def fixup_uuid_references(target_project, all_objects_by_uuid)
              fixup = ->(object, attr) do
                if object.respond_to?(attr) && link = all_objects_by_uuid[object.send(attr)]
                  object.send(:"#{attr}=", link.uuid)
                end
      Severity: Minor
      Found in lib/xcodeproj/project/uuid_generator.rb - 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

      Method resolve_variable_substitution has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def resolve_variable_substitution(key, value, root_target, previous_key = nil)
                case value
                when Array
                  return value.map { |v| resolve_variable_substitution(key, v, root_target) }
                when nil
      Severity: Minor
      Found in lib/xcodeproj/project/object/build_configuration.rb - About 1 hr to fix

        Method expand_build_setting has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def expand_build_setting(build_setting_value, config_value)
                  if build_setting_value.is_a?(Array) && config_value.is_a?(String)
                    config_value = split_build_setting_array_to_string(config_value)
                  elsif build_setting_value.is_a?(String) && config_value.is_a?(Array)
                    build_setting_value = split_build_setting_array_to_string(build_setting_value)
        Severity: Minor
        Found in lib/xcodeproj/project/object/build_configuration.rb - 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

        Method find_subpath has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def find_subpath(path, should_create = false)
                  return self unless path
                  path = path.split('/') unless path.is_a?(Array)
                  child_name = path.shift
                  child = children.find { |c| c.display_name == child_name }
        Severity: Minor
        Found in lib/xcodeproj/project/object/group.rb - 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

        Method new_target has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def self.new_target(project, type, name, platform, deployment_target, product_group, language, product_basename)
        Severity: Major
        Found in lib/xcodeproj/project/project_helper.rb - About 1 hr to fix

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

              def self.array_non_unique_diff(value_1, value_2)
                value_2_elements_by_count = value_2.reduce({}) do |hash, element|
                  updated_element_hash = hash.key?(element) ? { element => hash[element] + 1 } : { element => 1 }
                  hash.merge(updated_element_hash)
                end
          Severity: Minor
          Found in lib/xcodeproj/differ.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

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

                  def validate_value(object)
                    return unless object
                    acceptable = classes.find { |klass| object.class == klass || object.class < klass }
                    if type == :simple
                      raise "[Xcodeproj] Type checking error: got `#{object.class}` " \
          Severity: Minor
          Found in lib/xcodeproj/project/object_attributes.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

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

                  def validate_value_for_key(object, key)
                    unless type == :references_by_keys
                      raise '[Xcodeproj] This method should be called only for ' \
                        'attributes of type `references_by_keys`'
                    end
          Severity: Minor
          Found in lib/xcodeproj/project/object_attributes.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

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

                def generate_paths(object, path = '')
                  existing = @paths_by_object[object] || path
                  return existing if @paths_by_object.key?(object)
                  @paths_by_object[object] = path.size > existing.size ? path : existing
          
          
          Severity: Minor
          Found in lib/xcodeproj/project/uuid_generator.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

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

                    def attribute(name, klass, default_value = nil)
                      attrb = AbstractObjectAttribute.new(:simple, name, self)
                      attrb.classes = [klass]
                      attrb.default_value = default_value
                      add_attribute(attrb)
          Severity: Minor
          Found in lib/xcodeproj/project/object_attributes.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

          Method new_target has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def new_target(type, name, platform, deployment_target = nil, product_group = nil, language = nil, product_basename = nil)
          Severity: Major
          Found in lib/xcodeproj/project.rb - About 50 mins to fix

            Method new_legacy_target has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def self.new_legacy_target(project, name, build_tool_path = '/usr/bin/make', build_arguments_string = '$(ACTION)',
                                             build_working_directory = nil, pass_build_settings_in_environment = '1')
            Severity: Minor
            Found in lib/xcodeproj/project/project_helper.rb - About 45 mins to fix

              Method initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def initialize(target_or_node = nil, runnable_debugging_mode = nil, bundle_identifier = nil, remote_path = nil)
                      create_xml_element_with_fallback(target_or_node, 'RemoteRunnable') do
                        self.buildable_reference = BuildableReference.new(target_or_node) if target_or_node
                        @xml_element.attributes['runnableDebuggingMode'] = runnable_debugging_mode.to_s if runnable_debugging_mode
                        @xml_element.attributes['BundleIdentifier'] = bundle_identifier.to_s if bundle_identifier
              Severity: Minor
              Found in lib/xcodeproj/scheme/remote_runnable.rb - About 45 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

              Method create_xml_element_with_fallback has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def create_xml_element_with_fallback(node, tag_name)
                      if node && node.is_a?(REXML::Element)
                        raise Informative, 'Wrong XML tag name' unless node.name == tag_name
                        @xml_element = node
                      else
              Severity: Minor
              Found in lib/xcodeproj/scheme/xml_element_wrapper.rb - About 45 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