mrackwitz/xcres

View on GitHub
lib/xcres/builder/resources_builder.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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 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 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_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 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

There are no issues that match your filters.

Category
Status