Showing 714 of 1,025 total issues
Function detect_browser
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function detect_browser(){
var browser = new Object();
browser.name = navigator.appName;
browser.fullVersion = ''+parseFloat(navigator.appVersion);
browser.majorVersion = parseInt(navigator.appVersion,10);
- 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 to_presentation_version
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def to_presentation_version
Presentation::Version.new.tap do |presentation_version|
presentation_version.attributes.keys.each do |attr|
presentation_version.send("#{attr}=", send("#{attr}")) if respond_to? attr and attr!="id"
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 authorize_related_items
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def authorize_related_items(related)
related.each do |key, res|
res[:items].uniq!
res[:items].compact!
unless res[:items].empty?
- 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 filter_feeds_entries_with_chronological_order
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def filter_feeds_entries_with_chronological_order feeds, number_of_entries=10
filtered_entries = []
unless feeds.blank?
feeds.each do |feed|
entries = try_block{feed.entries}
- 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 recent_project_changes_hash
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def recent_project_changes_hash
projects=current_user.person.projects
people=Person.order('updated_at DESC')
- 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 process_permissions
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process_permissions permissions, resource_name, display_no_access=false
#remove the permissions with access_type=NO_ACCESS
permissions.select!{ |p| p.access_type != Policy::NO_ACCESS } unless display_no_access
html = ''
- 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 update
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update
data_file_ids = (params[:sample_data_file_ids].nil? ? [] : params[:sample_data_file_ids].reject(&:blank?)) || []
model_ids = (params[:sample_model_ids].nil? ? [] : params[:sample_model_ids].reject(&:blank?)) || []
sop_ids = (params[:sample_sop_ids].nil? ? [] : params[:sample_sop_ids].reject(&:blank?)) || []
@sample.attributes = params[:sample]
- 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 update
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update
# remove protected columns (including a "link" to content blob - actual data cannot be updated!)
if params[:sop]
[:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|
params[:sop].delete(column_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 builder_content
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def builder_content content_blob
filepath=content_blob.filepath
#this is necessary to get the correct filename and especially extension, which JWS relies on
tmpfile = Tempfile.new([content_blob.original_filename,File.extname(content_blob.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 update_params_for_batch
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update_params_for_batch(params)
data = []
data_urls = []
original_filenames = []
make_local_copy = []
- 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 populate_db
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def populate_db data
assay = nil
assay_json = data["assay"]
- 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 initialize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def initialize file, xml=nil, to_populate=true, institution_id = nil
@file = file
@investigation = nil
@study = 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 spreadsheet_contents_for_search
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def spreadsheet_contents_for_search obj=self
if obj.content_blob.is_extractable_spreadsheet?
content = Rails.cache.fetch("#{obj.content_blob.cache_key}-ss-content-for-search") do
begin
xml=obj.spreadsheet_xml
- 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 is_authorized?
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.is_authorized?(action, thing_type, thing, user=nil)
# initially not authorized, so if all tests fail -
# safe result of being not authorized will get returned
is_authorized = false
Function addSelected
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addSelected(resource_type, source) {
if (source == "target") {
for(var key in checkedTargetMap[resource_type]) {
if (allLinks[resource_type][key] == true) {
Method create
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@sample = Sample.new(params[:sample])
# create new specimen only for combined form
is_new_spec = params[:sample][:specimen_id].nil? ? true : false
Method update
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
#FIXME: would be better to resolve the differences, rather than keep clearing and reading the assets and organisms
#DOES resolve differences for assets now
organisms = params[:assay_organism_ids]||[]
Method create
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
params[:assay_class_id] ||= AssayClass.for_type("experimental").id
@assay = Assay.new(params[:assay])
organisms = params[:assay_organism_ids] || []
Method find_and_authorize_requested_item
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_and_authorize_requested_item
begin
name = self.controller_name.singularize
action = translate_action(action_name)
Function addSelectedOrganism
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addSelectedOrganism() {
selected_option_index=$("possible_organisms").selectedIndex;
selected_option=$("possible_organisms").options[selected_option_index];
title=selected_option.text;
id=selected_option.value;