fairplaysk/datacamp

View on GitHub

Showing 350 of 350 total issues

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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                                  $('#'+s.tooltipID).append('<iframe id="tooltipIE6FixIframe" style="width:'+($('#'+s.tooltipID).width()+parseFloat(s.borderSize)+parseFloat(s.borderSize)+20)+'px;height:'+($('#'+s.tooltipID).height()+parseFloat(s.borderSize)+parseFloat(s.borderSize)+20)+'px;position:absolute;top:-'+s.borderSize+'px;left:-'+s.borderSize+'px;filter:alpha(opacity=0);"src="blank.html"></iframe>');
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.tooltip.js and 1 other location - About 40 mins to fix
                  app/assets/javascripts/jquery.tooltip.js on lines 80..80

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 49.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                        document.css('#layout-column_column-2 .portlet-body a').each_with_index do |css_link|
                          if css_link.inner_text.include? '/'
                            href = css_link.attributes['href'].text
                            bulletin_and_year = css_link.inner_text.gsub(/ /, '').match(/.*?(\d*)\/(\d*)/u)
                            year = bulletin_and_year[2].to_i
                  Severity: Minor
                  Found in lib/etl/vvo_bulletin_extraction.rb and 1 other location - About 40 mins to fix
                  lib/etl/vvo_bulletin_downloader.rb on lines 137..142

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 38.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                        document.css('#layout-column_column-2 .portlet-body a').each_with_index do |css_link|
                          if css_link.inner_text.include? '/'
                            href = css_link.attributes['href'].text
                            bulletin_and_year = css_link.inner_text.gsub(/ /, '').match(/.*?(\d*)\/(\d*)/u)
                            year = bulletin_and_year[2].to_i
                  Severity: Minor
                  Found in lib/etl/vvo_bulletin_downloader.rb and 1 other location - About 40 mins to fix
                  lib/etl/vvo_bulletin_extraction.rb on lines 92..97

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 38.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  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

                          Consider simplifying this complex logical expression.
                          Open

                                  } else if ( typeof value === "string" && !rnocache.test( value ) &&
                                      (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
                                      !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
                          
                                      value = value.replace(rxhtmlTag, "<$1></$2>");
                          Severity: Major
                          Found in app/assets/javascripts/jquery.js - About 40 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                              elsif (code_text.match(/V\.*.*?[^\d]3[^\d]$/) || code_text.match(/V\.*.*?[^\d]4[^\d]$/)) && (header_text.match(/Názov a adresa/) || header_text.match(/NÁZOV A ADRESA/) || header_text.match(/Meno(.*)adresa(.*)víťaza/))
                                                supplier_information = next_element(code.parent)
                                                supplier_hash[:supplier_name] = supplier_information.xpath("./span[@class='titleValue']/span[1]").inner_text.strip
                                                supplier_hash[:supplier_organisation_code] = supplier_information.xpath(".//span[@class='titleValue']/span[3]").inner_text.strip
                            
                            
                            Severity: Major
                            Found in lib/etl/vvo_v2/suppliers_information_parser.rb - About 40 mins to fix

                              Function PSEUDO has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      PSEUDO: function( match, curLoop, inplace, result, not ) {
                              Severity: Minor
                              Found in app/assets/javascripts/jquery.js - About 35 mins to fix

                                Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def initialize(identifier, schema_manager, description_creator, system_columns, supported_types)
                                Severity: Minor
                                Found in app/models/dataset/table_describer.rb - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language