Showing 714 of 1,025 total issues
Method set_smtp_settings
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_smtp_settings (field, value)
if [:password, :user_name, :authentication].include? field.to_sym
if value.blank?
value = nil
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
Avoid deeply nested control flow statements. Open
if self.respond_to?(action_method) && !self.send(action_method)
result = false
errors.add(:base,"You are not permitted to change #{reflection.name} on #{self.class.name.underscore.humanize}-#{id} without #{action} rights")
break
end
Method bio_samples_population
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def bio_samples_population institution_id=nil, to_populate=true
begin
if content_blob.is_extractable_spreadsheet?
bio_samples = 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 hunt_for_field_values_mapped
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def hunt_for_field_values_mapped sheet, field_name, mapping, probing_num_rows = false
field_values = hunt_for_field_values sheet, mapping[field_name][:column], probing_num_rows
if field_values && !field_values.empty?
if probing_num_rows
- 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 basic_auth
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def basic_auth url, username,password, include_data=true
#This block is to ensure that only urls are encoded if they need it.
#This is to prevent already encoded urls being re-encoded, which can lead to % being replaced with %25.
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 treatments
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def treatments
Seek::Data::Treatments #this is just to load the class, incase it is already in the cache. Otherwise an underfined class/module error may occur
Rails.cache.fetch("treatments_#{content_blob.cache_key}") do
begin
if content_blob.is_extractable_spreadsheet?
- 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 request_publish_approval
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request_publish_approval
User.with_current_user current_user do
c = self.controller_name.downcase
a = self.action_name.downcase
- 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 uploaded_data_with_extension=
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def uploaded_data_with_extension=(file_data)
unless self.class == ForumAttachment || self.class == HelpAttachment || self.class == HelpImage #FIXME: This check is an indication that this extension is applied too broadly, I think.
upload_results = self.uploaded_data_without_extension=file_data
self.original_filename = file_data.original_filename
- 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 recursively_set_mime_type
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def recursively_set_mime_type(list, depth, type)
depth -= 1
list.map do |el|
if depth == 0
el == "application/x-error" ? el : type
- 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 ontology_select_tag_old
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ontology_select_tag_old form, type, root_id, element_id, selected_id=nil, html_options={}
Method extract_from_document
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extract_from_document doc
doc.root.namespaces.default_prefix = "ss"
template_sheet = 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 copy_file_between_zips
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def copy_file_between_zips(src, dest, name, ext)
if name.ends_with?('.error')
new_name = name
else
new_name = ext.nil? ? name : "#{name}#{ext}"
- 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_remote_content_blob
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cache_remote_content_blob
blobs = []
blobs << self.content_blob if self.respond_to?(:content_blob)
blobs = blobs | self.content_blobs if self.respond_to?(:content_blobs)
blobs.compact!
- 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
Consider simplifying this complex logical expression. Open
unless res.nil?
permissions.can_view = res["can_view"].to_s==@@expected_true_value && state_allows_manage?(user)
permissions.can_download = res["can_download"].to_s==@@expected_true_value && state_allows_manage?(user)
permissions.can_edit = res["can_edit"].to_s==@@expected_true_value && state_allows_manage?(user)
permissions.can_manage = res["can_manage"].to_s==@@expected_true_value && state_allows_manage?(user)
Function showDataTooltip
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function showDataTooltip(prefix,pagex,pagey,valuex,valuey) {
Function performSearch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function performSearch(data, regexps, queries, highlighters, state) {
Function select_cells
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function select_cells(startCol, startRow, endCol, endRow, sheetNumber) {
Method create_job
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.create_job subscribable_type, subscribable_id, project_ids, t=5.seconds.from_now, priority=1
Method feedback
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def feedback user,topic,details,send_anonymously,base_host
Method create_job
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.create_job subscribable_type, subscribable_id, old_project_ids, t=5.seconds.from_now, priority=1