fairplaysk/datacamp

View on GitHub

Showing 350 of 350 total issues

Avoid deeply nested control flow statements.
Open

                    if dictionary_main_subjects && dictionary_main_subjects.size > 1
                      contract_information_hash[:dictionary_main_subjects] = dictionary_main_subjects[1].strip
                    end
Severity: Major
Found in lib/etl/vvo_v2/contract_information_parser.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if type_element.empty?
                          tr_type_element = next_element(tr_type_element)
                          type_element = tr_type_element.xpath(".//span[@class='hodnota']")
                        end
    Severity: Major
    Found in lib/etl/vvo_v2/contract_information_parser.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                            while next_tr && next_tr.xpath(".//td[@class='kod']").inner_text.blank?
                              activities << next_tr.inner_text.strip if next_tr.inner_text.strip.present?
                              next_tr = next_tr.next_sibling
                            end
      Severity: Major
      Found in lib/etl/vvo_v2/customer_information_parser.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                              if category_element.inner_text.strip.blank?
                                category_element = category_element.next_sibling
                              end
        Severity: Major
        Found in lib/etl/vvo_v2/contract_information_parser.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                if place_element.inner_text.strip.blank?
                                  place_element = place_element.next_sibling
                                end
          Severity: Major
          Found in lib/etl/vvo_v2/contract_information_parser.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if price_value_element
                                      price_hash = parse_price2(price_value_element)
                                      performance_information_hash[:procurement_currency] = price_hash[:currency]
                                      performance_information_hash[:draft_price] = price_hash[:price]
                                      performance_information_hash[:draft_price_vat_included] = price_hash[:price_vat_included]
            Severity: Major
            Found in lib/etl/vvo_v2/performance_information_parser.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if @filters['quality_status'] == 'absent'
                            @dataset_class = @dataset_class.where('quality_status IS NULL OR quality_status = ?', @filters['quality_status'])
                          else
                            @dataset_class = @dataset_class.where(quality_status: @filters['quality_status'])
                          end
              Severity: Major
              Found in app/controllers/datasets_controller.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    category_number = Integer(project_type) rescue nil
                Severity: Major
                Found in lib/etl/vvo_v2/contract_information_parser.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      while duration_element && duration_element.xpath(".//td[@class='kod']").inner_text.blank?
                                        if duration_element.xpath(".//span[@class='podnazov']").inner_text.match(/Trvanie/)
                                          duration_unit = strip_last_point(duration_element.xpath(".//span[@class='hodnota']").inner_text.strip)
                                          performance_information_hash[:duration_unit] = duration_unit if duration_unit != "v intervale"
                                        elsif duration_element.xpath(".//span[@class='podnazov']").inner_text.match(/Hodnota/)
                  Severity: Major
                  Found in lib/etl/vvo_v2/performance_information_parser.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                      elsif code_text.match(/V\.*.*?[^\d]1[^\d]$/) && (header_text.match(/Dátum/) || header_text.match(/DÁTUM/))
                                        contract_date_element = tr.xpath(".//span[@class='hodnota']")
                                        supplier_hash[:contract_date] = parse_date(contract_date_element.inner_text.strip)
                    
                                      elsif code_text.match(/V\.*.*?[^\d]2[^\d]$/) && (header_text.match(/Počet prijatých/) || header_text.match(/POČET PRIJATÝCH/))
                    Severity: Major
                    Found in lib/etl/vvo_v2/suppliers_information_parser.rb - About 45 mins 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

                      Avoid deeply nested control flow statements.
                      Open

                                        supplier[:supplier_ico] = (Float(supplier[:supplier_ico]) rescue supplier[:supplier_ico])
                      Severity: Major
                      Found in lib/etl/vvo_extraction.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                          elsif header1.match(/Verejný obstarávateľ nakupuje/) || header2.match(/Verejný obstarávateľ nakupuje/)
                                            customer_information_hash[:customer_purchase_for_others] = !content.match(/Nie/)
                        Severity: Major
                        Found in lib/etl/vvo_v2/customer_information_parser.rb - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if previous_status.match(/Áno/)
                          
                                                previous_notification_element = next_element(previous_element)
                                                next_index = 0
                                                while previous_notification_element && previous_notification_element.xpath(".//span[@class='code']").empty?
                          Severity: Major
                          Found in lib/etl/vvo_v2/procedure_information_parser.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if contract_name_element.name == "div" && contract_name_element.attributes["class"].value == "textArea"
                                                  supplier_hash[:contract_name] = contract_name_element.xpath(".//span[2]").inner_text.strip
                                                end
                            Severity: Major
                            Found in lib/etl/vvo_v2/suppliers_information_parser.rb - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  while duration_element && duration_element.xpath(".//span[@class='code']").inner_text.blank?
                                                    if duration_element.inner_text.match(/Trvanie/)
                                                      performance_information_hash[:duration_unit] = duration_element.xpath(".//span[1]").inner_text.strip
                                                    elsif duration_element.inner_text.match(/Hodnota/)
                                                      performance_information_hash[:duration] = duration_element.xpath(".//span[1]").inner_text.to_i
                              Severity: Major
                              Found in lib/etl/vvo_v2/performance_information_parser.rb - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                      elsif price_element.inner_text.strip.match(/Skutočne zaplatená cena/)
                                                        price_value_element = next_price_value_element(price_element)
                                                        if price_value_element
                                                          price_hash = parse_price2(price_value_element)
                                                          performance_information_hash[:procurement_currency] = price_hash[:currency]
                                Severity: Major
                                Found in lib/etl/vvo_v2/performance_information_parser.rb - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                        suppliers << supplier_hash if supplier_hash[:supplier_name]
                                  Severity: Major
                                  Found in lib/etl/vvo_v2/suppliers_information_parser.rb - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                          suppliers << supplier_hash if supplier_hash[:supplier_name]
                                    Severity: Major
                                    Found in lib/etl/vvo_v2/suppliers_information_parser.rb - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          if place_header.match(/miesto/) || place_header.match(/stavenisko/)
                                                            contract_information_hash[:place_of_performance] = strip_last_point(tr_place_element.xpath(".//span[@class='hodnota']").inner_text.strip)
                                                          end
                                      Severity: Major
                                      Found in lib/etl/vvo_v2/contract_information_parser.rb - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language