Showing 322 of 581 total issues
Method remove_blank_translations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def remove_blank_translations(source)
source.inject({}) do |result, (k,v)|
result[k] = (v.is_a?(Hash) ? remove_blank_translations(v) : v) unless v.blank?
result
end
- 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_certificate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def new_certificate(options={}, &block)
text = t('menu.create_certificate')
if user_signed_in?
button = button_tag(options) { text }
content = block ? capture(button, &block) : button
- 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 end_of_dependencies
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def end_of_dependencies(question, answer, dependency, key, index, questions)
Method check_ckan_endpoint
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_ckan_endpoint
success = false
redirect = nil
if valid?
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 response_for
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def response_for(response_set, responses, question, answer = nil, response_group = nil)
Method certificate_from_dataset_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def certificate_from_dataset_url
params[:datasetUrl] ||= request.env['HTTP_REFERER']
dataset = Dataset.match_to_user_domain(params[:datasetUrl])
certificate = dataset.try(:certificate)
raise ActiveRecord::RecordNotFound unless dataset && certificate
- 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 compute_fields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compute_fields
return {} unless dataset.present?
begin
@fields = {}
- 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 precheck
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def precheck
limit = params["limit"].blank? ? nil : params["limit"].to_i
include_harvested = params.fetch("include_harvested", false)
include_harvested = include_harvested.eql?("true")
- 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 start
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def start
@documentation_url, url_explanation = params[:response_set].values_at(
:documentation_url, :documentation_url_explanation)
if request.put?
valid = 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
Method schema
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.schema(request)
survey = Survey.newest_survey_for_access_code request['jurisdiction']
return {errors: ['Jurisdiction not found']} if !survey
schema = {}
- 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 cache_question_or_answer_corresponding_to_requirement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cache_question_or_answer_corresponding_to_requirement
if survey_section && is_requirement?
self.question_corresponding_to_requirement ||= find_question_corresponding_to_requirement
unless self.question_corresponding_to_requirement
- 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 get_dataset_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_dataset_url(resource)
if resource['harvest_source_title'].blank?
return build_url("/dataset/#{resource['name']}")
else
if @include_harvested
- 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 too many return
statements within this function. Open
return autoValues.filter(function(value, i) { return value != selectedValues[i]; }).length === 0;
Method archive_other_response_sets
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def archive_other_response_sets
related = dataset.try(:response_sets) || []
related.each do |response_set|
if response_set.id != self.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 css_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def css_class(response_set)
triggered = triggered?(response_set) || (part_of_group? && question_group.dependent?)
[(dependent? ? "q_dependent" : nil), (triggered ? nil : "q_hidden"), custom_class].compact.join(" ")
end
- 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 response_errors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def response_errors
errors = Hash.new { |h, k| h[k] = [] }
incomplete_triggered_mandatory_questions.each do |question|
response = responses.where(question_id: question.id).first
- 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 no_published_certificate_exists
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def no_published_certificate_exists
documentation_url = params[:dataset][:documentationUrl]
return unless documentation_url.present?
existing_dataset = Dataset.where(documentation_url: documentation_url).first
if existing_dataset.try(:certificate).present?
- 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 copy_answers_from_response_set!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_answers_from_response_set!(source_response_set)
ui_hash = HashWithIndifferentAccess.new
raise "Attempt to over-write existing responses." if responses.any? # TODO: replace with specific exception
- 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 get_responses
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_responses
responses = []
self.response_set.survey.sections.each do |section|
qs = section.questions_for_certificate self.response_set
- 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 check_frequency
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_frequency
num_distributions = data[:distributions].length
if data[:update_frequency].blank?
num_distributions == 1 ? "oneoff" : "collection"
elsif num_distributions > 1
- 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"