fairplaysk/datacamp

View on GitHub
lib/etl/vvo_v2/parser_includes.rb

Summary

Maintainability
B
7 hrs
Test Coverage

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

      def parse_price2(price_element)
        price_hash = {}
        price_elements = price_element.xpath(".//span[@class='hodnota']")
        if price_elements.size == 1
          price_hash[:price] = parse_float(price_elements[0].inner_text.strip)
Severity: Minor
Found in lib/etl/vvo_v2/parser_includes.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 parse_price1 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_price1(price_element)
        price_hash = {}
        if price_element.xpath(".//span").size == 1
          price_hash[:price] = parse_float(price_element.xpath(".//span[1]").inner_text.strip)
          price_hash[:price_interval] = false
Severity: Minor
Found in lib/etl/vvo_v2/parser_includes.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 parse_price2 has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse_price2(price_element)
        price_hash = {}
        price_elements = price_element.xpath(".//span[@class='hodnota']")
        if price_elements.size == 1
          price_hash[:price] = parse_float(price_elements[0].inner_text.strip)
Severity: Minor
Found in lib/etl/vvo_v2/parser_includes.rb - About 1 hr to fix

    Method parse_price1 has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def parse_price1(price_element)
            price_hash = {}
            if price_element.xpath(".//span").size == 1
              price_hash[:price] = parse_float(price_element.xpath(".//span[1]").inner_text.strip)
              price_hash[:price_interval] = false
    Severity: Minor
    Found in lib/etl/vvo_v2/parser_includes.rb - About 1 hr to fix

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

            def parse_committee(str, match_keyword = false)
              patterns = [/(.*)Komisia na vyhodnocovanie ponúk:(.*)/, /(.*)Zoznam členov komisie, ktorí vyhodnocovali ponuky:(.*)/, /(.*)Ponuku hodnotila komisia v zložení:(.*)/, /(.*)Členovia komisie, ktorí vyhodnocovali ponuky:(.*)/, /(.*)Členovia komisie na vyhodnotenie ponúk s právom vyhodnocovať ponuky:(.*)/, /(.*)Na rokovacie konanie bez zverejnenia bola zriadená komisia v zložení(.*):(.*)/, /(.*)Komisia pracovala v tomto zložení(.*):(.*)/, /(.*)Členmi(.*)hodnotiacej komisie boli(.*):(.*)/, /(.*)komisia:(.*)/, /(.*)ktorí vyhodnocovali ponuky:(.*)/]
              patterns.each do |pattern|
                matches = str.match(pattern)
                if matches
      Severity: Minor
      Found in lib/etl/vvo_v2/parser_includes.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

      There are no issues that match your filters.

      Category
      Status