Showing 277 of 350 total issues
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
Avoid deeply nested control flow statements. Open
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
Avoid deeply nested control flow statements. Open
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
Avoid deeply nested control flow statements. Open
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]
Method perform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def perform
document_ids = []
css_links = document.css('#layout-column_column-2 .portlet-body a')
any_valid_link = false
- 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
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
Avoid deeply nested control flow statements. Open
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
Avoid deeply nested control flow statements. Open
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/))
Avoid deeply nested control flow statements. Open
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
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_price1(price_value_element)
performance_information_hash[:procurement_currency] = price_hash[:currency]
Consider simplifying this complex logical expression. Open
Open
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
Consider simplifying this complex logical expression. Open
Open
if ( (!special._default || special._default.call( elem, event ) === false) &&
!isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
try {
if ( target[ targetType ] ) {
Consider simplifying this complex logical expression. Open
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 ?
Consider simplifying this complex logical expression. Open
Open
if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
type === "select-multiple" ) {
return testChange.call( this, e );
}