fairplaysk/datacamp

View on GitHub
lib/etl/foundation_extraction.rb

Summary

Maintainability
C
1 day
Test Coverage

Method foundation has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

      def foundation
        registration_number = identification_number = name = address = objective = ''
        date_start = date_end = date_liquidation = date_registration = ''
        assets_value = assets_currency = nil

Severity: Minor
Found in lib/etl/foundation_extraction.rb - About 3 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 foundation has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def foundation
        registration_number = identification_number = name = address = objective = ''
        date_start = date_end = date_liquidation = date_registration = ''
        assets_value = assets_currency = nil

Severity: Major
Found in lib/etl/foundation_extraction.rb - About 2 hrs to fix

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

          def digest_founders(table)
            founders = []
            table.xpath(".//tr").each do |founder_row|
              founder_identification = founder_row.xpath(".//td[1]").inner_text.strip.split("\n")
              founder_contribution = founder_row.xpath(".//td[3]").inner_text[1..-2].strip.split(' ')
    Severity: Minor
    Found in lib/etl/foundation_extraction.rb - About 1 hr to fix

      Method create_resources has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def create_resources(resource_type, resources, attributes)
            all_ids = resources.map(&:_record_id)
            active_objects = []
            attributes.each do |obj_hash|
              case resource_type
      Severity: Minor
      Found in lib/etl/foundation_extraction.rb - About 1 hr to fix

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

              def digest_founders(table)
                founders = []
                table.xpath(".//tr").each do |founder_row|
                  founder_identification = founder_row.xpath(".//td[1]").inner_text.strip.split("\n")
                  founder_contribution = founder_row.xpath(".//td[3]").inner_text[1..-2].strip.split(' ')
        Severity: Minor
        Found in lib/etl/foundation_extraction.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