Showing 277 of 350 total issues
Avoid deeply nested control flow statements. Open
Open
if ( !inplace ) {
curLoop = result;
}
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def create
# Special case when we wanna automagically create description for some field
@field_description = @dataset_description.field_descriptions.build(params[:field_description])
- 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 ( !anyFound ) {
return [];
}
Avoid deeply nested control flow statements. Open
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
Avoid deeply nested control flow statements. Open
Open
if project_type_matches
project_type = project_type_matches[2]
end
Avoid deeply nested control flow statements. Open
Open
supplier[:supplier_ico] = ico if code.next.xpath(".//table[1]//tr[2]").inner_text.match(/I(Č|C)O/)
Avoid deeply nested control flow statements. Open
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
Avoid deeply nested control flow statements. Open
Open
if dictionary_main_subjects && dictionary_main_subjects.size > 1
contract_information_hash[:dictionary_main_subjects] = dictionary_main_subjects[1].strip
end
Avoid deeply nested control flow statements. Open
Open
if type_element.empty?
tr_type_element = next_element(tr_type_element)
type_element = tr_type_element.xpath(".//span[@class='hodnota']")
end
Avoid deeply nested control flow statements. Open
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
Avoid deeply nested control flow statements. Open
Open
if category_element.inner_text.strip.blank?
category_element = category_element.next_sibling
end
Avoid deeply nested control flow statements. Open
Open
if place_element.inner_text.strip.blank?
place_element = place_element.next_sibling
end
Avoid deeply nested control flow statements. Open
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]
Avoid deeply nested control flow statements. Open
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
Avoid deeply nested control flow statements. Open
Open
category_number = Integer(project_type) rescue nil
Avoid deeply nested control flow statements. Open
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/)
Avoid deeply nested control flow statements. Open
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/))
Method parse_committee
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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
- 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
supplier[:supplier_ico] = (Float(supplier[:supplier_ico]) rescue supplier[:supplier_ico])
Avoid deeply nested control flow statements. Open
Open
elsif header1.match(/Verejný obstarávateľ nakupuje/) || header2.match(/Verejný obstarávateľ nakupuje/)
customer_information_hash[:customer_purchase_for_others] = !content.match(/Nie/)