Showing 350 of 350 total issues
Avoid deeply nested control flow statements. Open
Open
if nuts_header.match(/NUTS/)
tr_nuts_content_element = next_element(tr_nuts_element)
nuts_code = tr_nuts_content_element.xpath(".//span[@class='hodnota']").inner_text.strip
contract_information_hash[:nuts_code] = strip_last_point(nuts_code)
end
Method load_record
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def load_record
@dataset_description = DatasetDescription.find(params[:dataset_id])
@dataset_class = @dataset_description.dataset_model
if params[:id]
- Read upRead up
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
Open
if first_criteria_element.any?
procedure_offers_criteria = strip_last_point(first_criteria_element.inner_text.strip)
next_criteria_element = tr_first_criteria_element.next_sibling
while next_criteria_element && next_criteria_element.xpath(".//td[@class='kod']").inner_text.blank?
if next_criteria_element.inner_text.strip.present?
Avoid deeply nested control flow statements. Open
Open
if project_type_element
header_procedure_and_project_information_hash[:project_type] = project_type_element.inner_text
end
Avoid deeply nested control flow statements. Open
Open
if place_header.match(/V prípade zmluvy/)
tr_place_element = next_element(tr_place_element)
place_header = tr_place_element.xpath(".//span[@class='podnazov']").inner_text
end
Avoid deeply nested control flow statements. Open
Open
if @filters['quality_status'] == 'absent'
@dataset_class = @dataset_class.where('t.quality_status IS NULL OR t.quality_status = ?', @filters['quality_status'])
else
@dataset_class = @dataset_class.where('t.quality_status = ?', @filters['quality_status'])
end
Avoid deeply nested control flow statements. Open
Open
if price_detail.inner_text.match(/Hodnota udelených (cien|ocenení) a\/alebo odmien(.*)DPH/)
supplier[:vat_included] = !price_detail.inner_text.match(/Hodnota udelených (cien|ocenení) a\/alebo odmien(.*)(.)DPH/)[2].downcase.match(/bez/)
prices = price_detail.xpath(".//span")
supplier[:price] = prices[0].inner_text.gsub(' ', '').gsub(',', '.').to_f
Avoid deeply nested control flow statements. Open
Open
if dictionary_element.xpath(".//div[2]").inner_text.match(/Doplňujúce predmety/) && dictionary_element.xpath(".//div[3]").any?
dictionary_additional_subjects = dictionary_element.xpath(".//div[3]").inner_text.match(/Hlavný slovník: (.*)/)
if dictionary_additional_subjects && dictionary_additional_subjects.size > 1
contract_information_hash[:dictionary_additional_subjects] = dictionary_additional_subjects[1].strip
end
Avoid deeply nested control flow statements. Open
Open
elsif code_text.match(/^IV.2.2/) && header_text.match(/Využila sa elektronická aukcia/)
auction_element = tr.xpath(".//td[2]//span[@class='hodnota']")
procedure_information_hash[:procedure_use_auction] = auction_element.inner_text.strip.match(/Áno/).present?
elsif code_text.match(/^IV.3.2/) && header_text.match(/Predchádzajúce oznámenie/)
Avoid deeply nested control flow statements. Open
Open
if type_element.next_sibling.next_sibling.inner_text.match(/Kategória služby číslo/)
category_element = type_element.next_sibling.next_sibling
contract_information_hash[:project_category] = category_element.xpath(".//span[2]").inner_text.strip
else #237455
category_element = type_element
Avoid deeply nested control flow statements. Open
Open
elsif code_text.match(/^II.1.6/) && (header_text.match(/Informácie o rámcovej dohode/) || header_text.match(/GPA/))
gpa_agreement = code.parent.next_sibling.next_sibling.xpath(".//span")
contract_information_hash[:gpa_agreement] = !gpa_agreement.inner_text.match(/Nie/)
Avoid deeply nested control flow statements. Open
Open
supplier[:note] = "Zahranicne IČO: #{supplier[:supplier_ico]}" if supplier[:supplier_ico] && supplier[:supplier_ico].class != Float
Avoid deeply nested control flow statements. Open
Open
while notification_element && notification_element.xpath(".//span[@class='code']").inner_text.blank?
if notification_element.inner_text.match(/Číslo oznámenia v(.*)EÚ/)
if notification_element.xpath(".//span")
eu_number = notification_element.xpath(".//span").inner_text.strip
date_element = notification_element.xpath(".//span").first.next_sibling
Avoid deeply nested control flow statements. Open
Open
if supplier_hash.any?
suppliers << supplier_hash if supplier_hash[:supplier_name]
supplier_hash = {}
end
Avoid deeply nested control flow statements. Open
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
Avoid deeply nested control flow statements. Open
Open
next unless tr_place_element
Avoid deeply nested control flow statements. Open
Open
if supplier_hash.any?
suppliers << supplier_hash if supplier_hash[:supplier_name]
supplier_hash = {}
end
Method basic_information
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def basic_information
header = document.xpath("//div[@class='oznamenie']")
procurement_code = bulletin_code = year = published_on = procurement_type = nil
- Read upRead up
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
Open
next unless tr_nuts_element
Avoid deeply nested control flow statements. Open
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