fairplaysk/datacamp

View on GitHub

Showing 277 of 350 total issues

Avoid deeply nested control flow statements.
Open

                    if ( !inplace ) {
                        curLoop = result;
                    }
Severity: Major
Found in app/assets/javascripts/jquery.js - About 45 mins to fix

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

      def create
        # Special case when we wanna automagically create description for some field
    
        @field_description = @dataset_description.field_descriptions.build(params[:field_description])
    
    
    Severity: Minor
    Found in app/controllers/field_descriptions_controller.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

                        if ( !anyFound ) {
                            return [];
                        }
    Severity: Major
    Found in app/assets/javascripts/jquery.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                            if type_element.inner_text.match(/Tovary/) && category_element.inner_text.match(/Tovary/)
                              category_element = next_element(category_element)
                              place_is_next = true
                            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 project_type_matches
                              project_type = project_type_matches[2]
                            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

                            supplier[:supplier_ico] = ico if code.next.xpath(".//table[1]//tr[2]").inner_text.match(/I(Č|C)O/)
          Severity: Major
          Found in lib/etl/vvo_extraction.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                  if category_element.inner_text.match(/Kategórie služieb sú uvedené v prílohe C1/)
                                    content = category_element.xpath(".//span[2]").inner_text.strip
                                  elsif category_element.inner_text.match(/Kategória služby číslo/)
                                    category_element = next_element(category_element)
                                    content = category_element.xpath(".//span[2]").inner_text.strip
            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 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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language