mrackwitz/xcres

View on GitHub

Showing 11 of 11 total issues

Method integrate! has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def integrate!(output_path, parent_group)
    # Find or create shell script build phase
    build_phase = target.shell_script_build_phases.find do |bp|
      bp.name == BUILD_PHASE_NAME
    end
Severity: Minor
Found in lib/xcres/command/install_command.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

Method transform_key has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def transform_key key, options
      # Split the key into components
      components = key.underscore.split /[\_\.\-\/ ]/

      # Build the new key incremental
Severity: Minor
Found in lib/xcres/builder/resources_builder.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

Method read_strings_file has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def read_strings_file(path)
      raise ArgumentError, "File '#{path}' doesn't exist" unless path.exist?
      raise ArgumentError, "File '#{path}' is not a file" unless path.file?
      error = `plutil -lint -s "#{path}" 2>&1`
      raise ArgumentError, "File %s is malformed:\n#{error}" % path.to_s unless $?.success?
Severity: Minor
Found in lib/xcres/analyzer/strings_analyzer.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 enumerate_sections has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def enumerate_sections
      # Iterate sections ordered by key
      for section_key, section_content in @sections.sort
        next if section_content.length == 0

Severity: Minor
Found in lib/xcres/builder/resources_builder.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 integrate! has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def integrate!(output_path, parent_group)
    # Find or create shell script build phase
    build_phase = target.shell_script_build_phases.find do |bp|
      bp.name == BUILD_PHASE_NAME
    end
Severity: Minor
Found in lib/xcres/command/install_command.rb - About 1 hr to fix

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

      def add_section name, items, options = {}
        raise ArgumentError.new 'No items given!' if items.nil?
    
        transformed_items = {}
    
    
    Severity: Minor
    Found in lib/xcres/builder/resources_builder.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 build_section_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def build_section_data file_paths, options={}
            options = {
              use_basename: [],
              path_without_ext: false,
            }.merge options
    Severity: Minor
    Found in lib/xcres/analyzer/resources_analyzer/base_resources_analyzer.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 build_swift_contents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_swift_contents swift_file
          swift_file.writeln BANNER
          swift_file.writeln 'public class %s {' % resources_constant_name
          swift_file.section do |struct|
            enumerate_sections do |section_key, enumerate_keys|
    Severity: Minor
    Found in lib/xcres/builder/resources_builder.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

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

      def inform_colored message, color, *format_args
        if colored?
          parts = message
             .gsub(/%[\ +#]?\d*\.?\d*[a-z]/, "\0"+'\0'+"\0")
             .split("\0")
    Severity: Minor
    Found in lib/xcres/logger.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

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

        def build_header_contents h_file
          h_file.writeln BANNER
          h_file.writeln
          h_file.writeln '#import <Foundation/Foundation.h>'
          h_file.writeln
    Severity: Minor
    Found in lib/xcres/builder/resources_builder.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

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

        def read_plist_key(path, key)
          raise ArgumentError, "File '#{path}' doesn't exist" unless path.exist?
          raise ArgumentError, 'Path is required, but nil' if path.nil?
          raise ArgumentError, 'Key is required, but nil' if key.nil?
          out = `/usr/libexec/PlistBuddy -c "Print :#{key}" "#{path}" 2>&1`.chomp
    Severity: Minor
    Found in lib/xcres/analyzer/strings_analyzer.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