Showing 1,025 of 1,025 total issues
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 new
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def new
@assay=Assay.new
@assay.create_from_asset = params[:create_from_asset]
study = Study.find(params[:study_id]) if params[:study_id]
@assay.study = study if params[:study_id] if study.try :can_edit?
- 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 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 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 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 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 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 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 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 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 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"]
Similar blocks of code found in 2 locations. Consider refactoring. Open
:assay_mapping => {
:assay_sheet_name => "Tabelle2",
:parsing_direction => "vertical",
:probing_column => :"creator.last_name",
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def create
@help_document = HelpDocument.find(params[:help_attachment][:help_document_id])
@help_attachment = HelpAttachment.new(params[:help_attachment])
if @help_attachment.save
@error_text = []
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
:assay_mapping => {
:assay_sheet_name => "Tabelle1",
:parsing_direction => "vertical",
:probing_column => :"creator.last_name",
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def create
@help_document = HelpDocument.find(params[:help_image][:help_document_id])
@help_image = HelpImage.new(params[:help_image])
if @help_image.save
@error_text = []
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 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]