Showing 277 of 350 total issues
Avoid deeply nested control flow statements. Open
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?
Avoid deeply nested control flow statements. Open
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
Avoid deeply nested control flow statements. Open
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
Avoid deeply nested control flow statements. Open
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]
Avoid deeply nested control flow statements. Open
Open
suppliers << supplier_hash if supplier_hash[:supplier_name]
Avoid deeply nested control flow statements. Open
Open
suppliers << supplier_hash if supplier_hash[:supplier_name]
Avoid deeply nested control flow statements. Open
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
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