fairplaysk/datacamp

View on GitHub

Showing 277 of 350 total issues

Avoid deeply nested control flow statements.
Open

                    if supplier_hash.any?
                      suppliers << supplier_hash if supplier_hash[:supplier_name]
                      supplier_hash = {}
                    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

                          if nuts_element.xpath(".//div").any?
                            contract_information_hash[:nuts_code] = nuts_element.xpath(".//div").inner_text
                          else
                            contract_information_hash[:nuts_code] = next_element(nuts_element).inner_text.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

                          next unless tr_place_element
      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 supplier_hash.any?
                              suppliers << supplier_hash if supplier_hash[:supplier_name]
                              supplier_hash = {}
                            end
        Severity: Major
        Found in lib/etl/vvo_v2/suppliers_information_parser.rb - About 45 mins to fix

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

                def basic_information
                  header = document.xpath("//div[@class='oznamenie']")
          
                  procurement_code = bulletin_code = year = published_on = procurement_type = nil
          
          
          Severity: Minor
          Found in lib/etl/vvo_v2/basic_information_parser.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

                              next unless tr_nuts_element
          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_criteria_element && next_criteria_element.xpath(".//span[@class='code']").empty?
                                    if next_criteria_element.inner_text.strip.present?
                                      procedure_offers_criteria+= ', ' + next_criteria_element.inner_text.strip
                                    end
                                    next_criteria_element = next_criteria_element.next_sibling
            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 project_type_exceptions.include?(project_type)
                                    contract_information_hash[:project_type] = project_type_exceptions[project_type]
                                    contract_information_hash[:project_category] = project_type
                                    tr_category_element = tr_type_element
                                  elsif category_number
              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.inner_text.strip.match(/Verejný obstarávateľ nakupuje/).nil? && next_tr.xpath(".//td[@class='kod']").inner_text.blank?)
                                      content = next_tr.inner_text.strip
                                      activities << content if content.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 price_value_element
                                            price_hash = parse_price1(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

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

                        def perform
                          document_ids = []
                          css_links = document.css('#layout-column_column-2 .portlet-body a')
                    
                          any_valid_link = false
                    Severity: Minor
                    Found in lib/etl/vvo_bulletin_downloader.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

                                    elsif code.inner_text.match(/Hodnota udelených (cien|ocenení) a\/alebo odmien(.*)DPH/)
                                      supplier[:vat_included] = !code.inner_text.match(/Hodnota udelených (cien|ocenení) a\/alebo odmien(.*)(.)DPH/)[2].downcase.match(/bez/)
                    
                                      prices = code.xpath(".//span[@class='hodnota']")
                                      supplier[:price] = prices[0].inner_text.gsub(' ', '').gsub(',', '.').to_f
                    Severity: Major
                    Found in lib/etl/vvo_extraction.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          while notification_element && notification_element.xpath(".//td[@class='kod']").inner_text.blank?
                                            if notification_element.inner_text.match(/Číslo oznámenia v(.*)EÚ/)
                                              matches = notification_element.xpath(".//span[@class='hodnota']").inner_text.match(/(.*) z (.*)/)
                                              if matches && matches.size == 3
                                                eu_number = matches[1].strip
                      Severity: Major
                      Found in lib/etl/vvo_v2/additional_information_parser.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                          elsif code_text.match(/V\.*.*?[^\d]2[^\d]$/) && (header_text.match(/Počet predložených ponúk/) || header_text.match(/Počet uchádzačov, ktorí predložili ponuku/))
                                            offers_total_count_element = next_element(code.parent)
                                            supplier_hash[:offers_total_count] = offers_total_count_element.inner_text.strip.to_i
                        
                                          elsif code_text.match(/V\.*.*?[^\d]1[^\d]$/) && (header_text.match(/Počet uchádzačov/))
                        Severity: Major
                        Found in lib/etl/vvo_v2/suppliers_information_parser.rb - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                            elsif code_text.match(/^II.1.3/) && header_text.match(/Oznámenie zahŕňa/)
                                              tr_general_contract = tr
                                              if tr_general_contract.xpath(".//td[2]//span[@class='hodnota']").empty?
                                                tr_general_contract = tr.next_element
                                              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

                                                  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_price1(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

                              Consider simplifying this complex logical expression.
                              Open

                              if ( jQuery.expr && jQuery.expr.filters ) {
                                  jQuery.expr.filters.hidden = function( elem ) {
                                      var width = elem.offsetWidth,
                                          height = elem.offsetHeight;
                              
                              
                              Severity: Major
                              Found in app/assets/javascripts/jquery.js - About 40 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                            if ( (!special._default || special._default.call( elem, event ) === false) && 
                                                !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
                                
                                                try {
                                                    if ( target[ targetType ] ) {
                                Severity: Major
                                Found in app/assets/javascripts/jquery.js - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                          if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
                                                  Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
                                  
                                              ret = Sizzle.find( parts.shift(), context, contextXML );
                                              context = ret.expr ?
                                  Severity: Major
                                  Found in app/assets/javascripts/jquery.js - About 40 mins to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                                    if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
                                                        (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
                                                        type === "select-multiple" ) {
                                                        return testChange.call( this, e );
                                                    }
                                    Severity: Major
                                    Found in app/assets/javascripts/jquery.js - About 40 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language