Showing 714 of 1,025 total issues
Method preview_permissions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def preview_permissions
policy = sharing_params_to_policy
current_person = User.current_user.try(:person)
contributor_person = (params['is_new_file'] == 'false') ? User.find_by_id(params['contributor_id'].to_i).try(:person) : current_person
creators = (params["creators"].blank? ? [] : ActiveSupport::JSON.decode(params["creators"])).uniq
- 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_workflow_metadata
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def extract_workflow_metadata
@t2flow = T2Flow::Parser.new.parse(@workflow.content_blob.data_io_object.read)
@workflow.title = @t2flow.annotations.titles.last unless @t2flow.annotations.titles.last.blank?
@workflow.description = @t2flow.annotations.descriptions.last
- 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 destroy
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def destroy
object=params[:class].capitalize.constantize.find(params[:id])
if object && object.is_a?(Sample)
specimen = object.specimen
id_column = Seek::Config.is_virtualliver ? 8 : 6
- 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 auth
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def auth
# Skip certain auth if run is embedded
if @run.embedded
if ['cancel','read_interaction','write_interaction'].include?(action_name)
return 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 uri_for_object
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.uri_for_object(resource_obj, *args)
options = args.extract_options!
# defaults:
options.reverse_merge!(:params => nil,
:sub_path => 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 filter_size
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def filter_size size
max_size=1500
matches = size.match /([0-9]+)x([0-9]+).*/
if matches
width = matches[1].to_i
- 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 add_roles
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_roles roles
new_mask = self.roles_mask || 0
roles.each do |role_details|
rolename = role_details[0]
raise UnknownRoleException.new("Unrecognised role name #{rolename}") unless ROLES.include?(rolename)
- 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
Function updatePublications
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updatePublications() {
publication_text='<ul class="related_asset_list">'
for (var i=0;i<publication_array.length;i++) {
publication=publication_array[i];
Function updateModels
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateModels() {
model_text='<ul class="related_asset_list">';
type="Model";
model_ids=new Array();
Function updateDataFiles
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateDataFiles() {
data_file_text='<ul class="related_asset_list">'
for (var i=0;i<data_files_assets.length;i++) {
data_file=data_files_assets[i];
Method included
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included klass
klass.class_eval do
include Seek::Search::CommonFields
searchable do
Method populate_assay
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def populate_assay assay_json, filename
investigation_title = assay_json["investigation title"]
assay_type_title = assay_json["assay type title"]
study_title = assay_json["study title"]
Function parse
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parse(nodes, tree, id) {
for (var i = 0; i < nodes.length; i++) {
if (1 != nodes[i].nodeType) {
continue;
}
Function updateSops
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateSops() {
sop_text='<ul class="related_asset_list">';
sop_ids=new Array();
Method create
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
if handle_upload_data
@presentation = Presentation.new(params[:presentation])
@presentation.policy.set_attributes_with_sharing params[:sharing], @presentation.projects
Method perform_search
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform_search
@search_query = params[:search_query]
@search=@search_query # used for logging, and logs the origin search query - see ApplicationController#log_event
@search_query||=""
@search_type = params[:search_type]
Method edit_tag
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edit_tag
if request.post?
@tag=TextValue.find(params[:id])
replacement_tags = []
Method create
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@publication = Publication.new(params[:publication])
@publication.pubmed_id=nil if @publication.pubmed_id.blank?
@publication.doi=nil if @publication.doi.blank?
pubmed_id,doi = preprocess_doi_or_pubmed @publication.pubmed_id,@publication.doi
Consider simplifying this complex logical expression. Open
unless sample.specimen == specimen &&
sample.sample_type == sample_type &&
(sample.tissue_and_cell_types.member?(tissue_and_cell_type) || tissue_and_cell_type_title == "") &&
sample.donation_date == Time.zone.parse(donation_date).utc &&
sample.institution == institution &&
Function init
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var init = function(){
// merge user-supplied options with the defaults
slider.settings = $.extend({}, defaults, options);
// parse slideWidth setting
slider.settings.slideWidth = parseInt(slider.settings.slideWidth);