Showing 1,025 of 1,025 total issues
Method filter_size
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def filter_size size
size = size[0..-($1.length.to_i + 2)] if size =~ /[0-9]+x[0-9]+\.([a-z0-9]+)/ # trim file extension
max_size=MAX_SIZE
matches = size.match /([0-9]+)x([0-9]+).*/
if matches
- 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 duesseldorf_bode_surgical_mapping
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def duesseldorf_bode_surgical_mapping
gene_modification_regex = /([\w\d]+)([\/+-]+)/
{
- 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_substance
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def update_substance(substance)
unless substance.blank?
#call the webservice to retrieve the substance annotation from sabiork
#the annotation is stored in a hash, which keys: recommended_name, synonyms, sabiork_id, chebi_ids, kegg_ids
compound_annotation = Seek::SabiorkWebservices.new().get_compound_annotation(substance)
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
# remove protected columns (including a "link" to content blob - actual data cannot be updated!)
if params[:model]
[:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|
params[:model].delete(column_name)
Method update
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
# remove protected columns (including a "link" to content blob - actual data cannot be updated!)
if params[:presentation]
[:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|
params[:presentation].delete(column_name)
Method open_id_authentication
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def open_id_authentication(identity_url)
# Pass optional :required and :optional keys to specify what sreg fields you want.
# Be sure to yield registration, a third argument in the #authenticate_with_open_id block.
authenticate_with_open_id(identity_url,
:required => [:email, :fullname,
Method insert_results
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insert_results
resources=[]
@project=Project.find(params[:project])
params.keys.each do |key|
if key.start_with?("title")
Function performSearch
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function performSearch(data, regexps, queries, highlighters, state) {
var searchIndex = data.searchIndex;
var longSearchIndex = data.longSearchIndex;
var info = data.info;
var result = [];
Method create
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@topic = Topic.find_by_id_and_forum_id(params[:topic_id],params[:forum_id])
if @topic.locked?
respond_to do |format|
format.html do
Method search_in_sabiork
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search_in_sabiork
unless params[:compound_name].blank?
compound_annotation = Seek::SabiorkWebservices.new().get_compound_annotation(params[:compound_name])
unless compound_annotation.blank?
synonyms = compound_annotation['synonyms'].inject{|result, s| result.concat("; #{s}")}
Method update
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
raise Exception.new("No ID") if seek_id.blank?
person_record=Person.find_by_id(seek_id)
raise Exception.new("Unable to find person with ID: #{seek_id}") if person_record.nil?
raise Exception.new("Person is not a member of Translucent") unless person_record.projects.include?(@project)
Similar blocks of code found in 2 locations. Consider refactoring. Open
collapse_link = link_to_function collapse_minus_image,:style => "float:left;" + "display:" + (display_style=='display:none' ? 'none;' : 'block;'), :id =>"projects_hierarchies_collapse_#{parent.id}_#{child.id}" do |page|
page.visual_effect :toggle_blind, "#{parent.id}_#{child.id}", :duration => 0.5
page["projects_hierarchies_expand_#{parent.id}_#{child.id}"].toggle
page["projects_hierarchies_collapse_#{parent.id}_#{child.id}"].toggle
- 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 63.
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
expand_link = link_to_function expand_plus_image, :style => "float:left;" + "display:" + (display_style=='display:none' ? 'block;' : 'none;'), :id =>"projects_hierarchies_expand_#{parent.id}_#{child.id}" do |page|
page.visual_effect :toggle_blind, "#{parent.id}_#{child.id}", :duration => 0.5
page["projects_hierarchies_expand_#{parent.id}_#{child.id}"].toggle
page["projects_hierarchies_collapse_#{parent.id}_#{child.id}"].toggle
- 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 63.
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
Method runs_table
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def runs_table(runs, redirect_to=nil)
runs.map do |run|
workflow = run.workflow
version = run.workflow_version
workflow_version = workflow.find_version(version)
Method menu_definitions
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def menu_definitions
definitions=[
{:title=>t("menu.yellow_pages"), :sections=>[
{:controller=>"programmes",:title=>t('programme').pluralize,:hide=>!Seek::Config.programmes_enabled},
{:controller=>"people",:title=>"People"},
Method update
has 37 lines of code (exceeds 25 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)
Method associate_authors
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def associate_authors
publication = @publication
projects = publication.projects
projects = current_user.person.projects if projects.empty?
association = {}
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (prefix == "reactions") {
$('species_search_box').value="";
$('species_selected_symbol').value="";
$('nameToSearch').value=$('reactions_search_box').value;
}
- 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 64.
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
if (prefix == "species") {
$('reactions_search_box').value="";
$('reactions_selected_symbol').value="";
$('nameToSearch').value=$('species_search_box').value;
}
- 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 64.
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 setPositionProperty
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
var setPositionProperty = function(value, type, duration, params){
// use CSS transform
if(slider.usingCSS){
// determine the translate3d value
var propValue = slider.settings.mode == 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';