SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

function absoluteCursorPostion(eventObj)
{
  eventObj = eventObj ? eventObj : window.event;
  
  if(isNaN(window.scrollX))
app/assets/javascripts/jws/Resizeable_Textbox/javascript.js on lines 145..154

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 135.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        for(var key in allLinks[resource_type]) {
            $(resource_type +"_" + key + "_target_row").hide();
            targetMap[resource_type][key] = false;
            sourceMap[resource_type][key] = true;
            checkedTargetMap[resource_type][key] = false;
Severity: Major
Found in app/assets/javascripts/link_adder.js and 1 other location - About 5 hrs to fix
app/assets/javascripts/link_adder.js on lines 70..81

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 135.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            if (allLinks[resource_type][key] == true) {

                $(resource_type +"_" + key + "_target_row").hide();
                targetMap[resource_type][key] = false;
                sourceMap[resource_type][key] = true;
Severity: Major
Found in app/assets/javascripts/link_adder.js and 1 other location - About 5 hrs to fix
app/assets/javascripts/link_adder.js on lines 21..31

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 135.

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

Further Reading

Method dortmund_hengstler_mapping has 123 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def dortmund_hengstler_mapping

      age_regex = /(\d+-?\d*)\s*(day|week|month|year)s?/i
      treatment_regex = /(\d*\.?\d*)\s*(\w+\/\w+)\s*([\w\.\s,']*),?\s+([\w\.]*)/
      incubation_time_regex = /(\d+\.?\d*)(\w{1})/
Severity: Major
Found in lib/seek/parser_mapper.rb - About 4 hrs to fix

    File person.rb has 366 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'grouped_pagination'
    
    class Person < ActiveRecord::Base
    
      include Seek::Rdf::RdfGeneration
    Severity: Minor
    Found in app/models/person.rb - About 4 hrs to fix

      Method included has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.included klass
              klass.class_eval do
                include Seek::Search::CommonFields
      
                searchable do
      Severity: Minor
      Found in lib/seek/search/search_sunspot.rb - About 4 hrs to fix

      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

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

            for (var i=0;i<triplets.length;i++) {
                trip = triplets[i];
                    row = "<tr><td>"+trip.urn+"</td><td>" + trip.full_name +"</td>";
                    js="javascript:add_search_result('"+prefix+"','"+key+"',"+i+");";
      
      
      Severity: Major
      Found in app/assets/javascripts/jws/jws_annotator.js and 2 other locations - About 4 hrs to fix
      app/assets/javascripts/jws/jws_annotator.js on lines 93..100
      app/assets/javascripts/jws/jws_annotator.js on lines 108..114

      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 130.

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                for (var i=0;i<triplets.length;i++) {
                    trip = triplets[i];
                    row = "<tr><td>"+trip.urn+"</td><td>" + trip.full_name +"</td>";
                    js="javascript:drop_annotation('"+prefix+"','"+key+"',"+i+");"
                    row = row + "<td><a href=\""+js+"\">Drop</a></td></tr>";
      Severity: Major
      Found in app/assets/javascripts/jws/jws_annotator.js and 2 other locations - About 4 hrs to fix
      app/assets/javascripts/jws/jws_annotator.js on lines 93..100
      app/assets/javascripts/jws/jws_annotator.js on lines 194..201

      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 130.

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

            for (var i=0;i<triplets.length;i++) {
                trip = triplets[i];
                    row = "<tr><td>"+trip.urn+"</td><td>" + trip.full_name +"</td>";
                    js="javascript:add_cached_annotation('"+prefix+"','"+key+"',"+i+");";
      
      
      Severity: Major
      Found in app/assets/javascripts/jws/jws_annotator.js and 2 other locations - About 4 hrs to fix
      app/assets/javascripts/jws/jws_annotator.js on lines 108..114
      app/assets/javascripts/jws/jws_annotator.js on lines 194..201

      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 130.

      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

      Further Reading

      Method set_default_subscriptions has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

        def set_default_subscriptions projects
          unless projects.empty?
            Person.scoped(:include => :project_subscriptions).each do |person|
              project_subscriptions = person.project_subscriptions
              project_subscriptions.each do |ps|
      Severity: Minor
      Found in lib/subscribable.rb - About 4 hrs to fix

      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

      File people_controller.rb has 357 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class PeopleController < ApplicationController
      
        include Seek::AnnotationCommon
        include Seek::Publishing::PublishingCommon
        include Seek::Publishing::GatekeeperPublish
      Severity: Minor
      Found in app/controllers/people_controller.rb - About 4 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            $j('#sweep_data .iteration').each(function () {
              var run_inputs = $j(this).children('.run_input');
              run_inputs.detach().sort(function(a,b) {
                return inputs[$j(a).data('input-name')].input_number - inputs[$j(b).data('input-name')].input_number;
              });
        Severity: Major
        Found in app/assets/javascripts/sweeps.js and 1 other location - About 4 hrs to fix
        app/assets/javascripts/sweeps.js on lines 101..107

        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 125.

        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

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            $j('#fixed_data').each(function () {
              var run_inputs = $j(this).children('.run_input');
              run_inputs.detach().sort(function(a,b) {
                return inputs[$j(a).data('input-name')].input_number - inputs[$j(b).data('input-name')].input_number;
              });
        Severity: Major
        Found in app/assets/javascripts/sweeps.js and 1 other location - About 4 hrs to fix
        app/assets/javascripts/sweeps.js on lines 108..114

        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 125.

        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

        Further Reading

        Method submit_to_jws has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

          def submit_to_jws
            following_action=params.delete("following_action")
            error=nil
        
            #FIXME: currently we have to assume that a model with multiple files only contains 1 model file that would be executed on jws online, and only the first one is chosen
        Severity: Minor
        Found in app/controllers/models_controller.rb - About 4 hrs to fix

        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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        function createCookie4(name,days,nameString) {
            if (days) {
                var date = new Date();
                date.setTime(date.getTime()+(days*86400000));
                var expires = "; expires="+date.toGMTString();
        Severity: Major
        Found in app/assets/javascripts/jws/JWSconstructor_panels.js and 1 other location - About 4 hrs to fix
        app/assets/javascripts/jws/JWSconstructor_panels.js on lines 116..126

        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 122.

        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

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        function createCookie3(name,days,nameString) {
            if (days) {
                var date = new Date();
                date.setTime(date.getTime()+(days*86400000));
                var expires = "; expires="+date.toGMTString();
        Severity: Major
        Found in app/assets/javascripts/jws/JWSconstructor_panels.js and 1 other location - About 4 hrs to fix
        app/assets/javascripts/jws/JWSconstructor_panels.js on lines 128..138

        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 122.

        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

        Further Reading

        Class Policy has 34 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Policy < ActiveRecord::Base
          
          has_many :permissions,
                   :dependent => :destroy,
                   :order => "created_at ASC",
        Severity: Minor
        Found in app/models/policy.rb - About 4 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if ( parseInt(document.documentElement.clientWidth+document.documentElement.scrollLeft) < parseInt(this.tip.offsetWidth+lt) ) {
                      this.tip.style.left = parseInt(lt-(this.tip.offsetWidth+10))+'px';
                  } else {
                      this.tip.style.left = lt+'px';
                  }
          Severity: Major
          Found in app/assets/javascripts/jws/sweetTitles.js and 1 other location - About 4 hrs to fix
          app/assets/javascripts/jws/sweetTitles.js on lines 88..92

          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 121.

          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

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if ( parseInt(document.documentElement.clientHeight+document.documentElement.scrollTop) < parseInt(this.tip.offsetHeight+tp) ) {
                      this.tip.style.top = parseInt(tp-(this.tip.offsetHeight+10))+'px';
                  } else {
                      this.tip.style.top = tp+'px';
                  }
          Severity: Major
          Found in app/assets/javascripts/jws/sweetTitles.js and 1 other location - About 4 hrs to fix
          app/assets/javascripts/jws/sweetTitles.js on lines 83..87

          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 121.

          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

          Further Reading

          Method list_samples_and_assay_organisms has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

            def list_samples_and_assay_organisms attribute, assay_samples, assay_organisms, html_options={}, none_text="Not Specified"
          
              result= "<p class='#{html_options[:class]}' id='#{html_options[:id]}'> <b>#{attribute}</b>: "
          
              result +="<span class='none_text'>#{none_text}</span>" if assay_samples.blank? and assay_organisms.blank?
          Severity: Minor
          Found in app/helpers/assays_helper.rb - About 4 hrs to fix

          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

          Severity
          Category
          Status
          Source
          Language