Showing 277 of 350 total issues
Avoid too many return
statements within this function. Open
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
Method restore
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def restore
@account = User.find_by_restoration_code(params[:id] || ".")
if request.put?
user = params[:user]
if user[:password].present? && user[:password] == user[:password_confirmation]
- 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
Method searched_datasets
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def searched_datasets
datasets = DatasetDescription.where(:is_active => true)
Rails.logger.info "search: find datasets"
- 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
Method new_from_session
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.new_from_session(session, request)
begin
self.current_session = self.find_or_create_by_session_id(session[:session_id])
rescue
begin
- 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
Method parse_recipient_2007_2012
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_recipient_2007_2012(td)
proposal = {}
e = td.css('span.cervene').first
return proposal unless e
proposal[:name] = clean_string(e.text)
- 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
Method build_sphinx_search
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_sphinx_search(search, sphinx_search)
search.query.predicates.each do |predicate|
field_description = field_descriptions.find_by_identifier(predicate.search_field)
operand = field_description.is_derived ? field_description.derived_value : field_description.identifier if field_description
sphinx_search = predicate.add_to_sphinx_search(operand, sphinx_search)
- 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
Method create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
search_params = params[:search] || {}
if search_params[:predicates]
query = SearchQuery.query_with_predicates(create_predicates_from_hash(search_params[:predicates]), :scope => "dataset", :object => search_params[:dataset])
search = Search.create(:query => query, :search_type => 'predicates', :session => @current_session)
- 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
Method download_procurements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.download_procurements(link_match, year_match)
agent = Mechanize.new
agent.get(SEARCH_URL)
if year_match
link_element = agent.page.link_with(text: year_match)
- 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
Method delete_relationship
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def delete_relationship
dataset_description = DatasetDescription.find(params[:dataset_id])
record = dataset_description.dataset_model.find_by_record_id(params[:id])
if params[:macro] == 'has_many'
related_dataset_description = DatasetDescription.find(params[:related_dataset])
- 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
Method all_bulletins_in_year
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.all_bulletins_in_year(in_year)
document_url = "http://www2.uvo.gov.sk/sk/evestnik/-/vestnik/all"
document = Nokogiri::HTML(Typhoeus::Request.get(document_url).body)
links = []
- 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
Method show
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show
@data_repair = DataRepair.find(params[:id])
begin
@data = get_preview_data(@data_repair)
rescue
- 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
Method digest_founders
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def digest_founders(table)
founders = []
table.xpath(".//tr").each do |founder_row|
founder_identification = founder_row.xpath(".//td[1]").inner_text.strip.split("\n")
founder_contribution = founder_row.xpath(".//td[3]").inner_text[1..-2].strip.split(' ')
- 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
Method build_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_attributes(values)
attributes = {}
values.each_with_index do |value, index|
- 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
Method extract_procurements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.extract_procurements(type, year)
procurements = []
LINKS[type].each do |link|
link_match = %r{#{"#{link} (.*)"}}
year_match = year ? %r{#{"#{year} (.*)"}} : 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
Method init_search_object
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def init_search_object
if params[:search_id].present?
@search_predicates = Search.find_by_id(params[:search_id]).query.predicates
elsif params[:controller] == 'searches' && params[:id].present?
search = Search.find_by_id(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
Method related_records_and_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def related_records_and_fields(dataset_description, record)
@dataset_class.reflect_on_all_associations.delete_if{ |a| a.name =~ /^dc_/ }.map do |reflection|
dd = DatasetDescription.find_by_identifier(
Dataset::Naming.association_name_to_identifier(reflection.name)
)
- 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
Method all_bulletins_in_year
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.all_bulletins_in_year(in_year)
document_url = ALL_BULLETINS_URL
document = Nokogiri::HTML(Typhoeus::Request.get(document_url).body)
links = {}
- 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"