ncbo/bioportal_web_ui

View on GitHub

Showing 628 of 628 total issues

Function renderTokens has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Writer.prototype.renderTokens = function (tokens, context, partials, originalTemplate) {
    var buffer = '';

    // This function is used to render an arbitrary template
    // in the current context by higher-order sections.
Severity: Major
Found in public/browse/lib/lunr.js/example/mustache.js - About 2 hrs to fix

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

    lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
      var isRegistered = fn.label && (fn.label in this.registeredFunctions)
    
      if (!isRegistered) {
        lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn)
    Severity: Major
    Found in public/browse/lib/lunr.js/lib/pipeline.js and 1 other location - About 2 hrs to fix
    public/browse/lib/lunr.js/lunr.js on lines 270..276

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

    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

    var lunr = function (config) {
      var idx = new lunr.Index
    
      idx.pipeline.add(
        lunr.trimmer,
    Severity: Major
    Found in public/browse/lib/lunr.js/lib/lunr.js and 1 other location - About 2 hrs to fix
    public/browse/lib/lunr.js/lunr.js on lines 45..57

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

    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

    lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
      var isRegistered = fn.label && (fn.label in this.registeredFunctions)
    
      if (!isRegistered) {
        lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn)
    Severity: Major
    Found in public/browse/lib/lunr.js/lunr.js and 1 other location - About 2 hrs to fix
    public/browse/lib/lunr.js/lib/pipeline.js on lines 70..76

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

    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

    var lunr = function (config) {
      var idx = new lunr.Index
    
      idx.pipeline.add(
        lunr.trimmer,
    Severity: Major
    Found in public/browse/lib/lunr.js/lunr.js and 1 other location - About 2 hrs to fix
    public/browse/lib/lunr.js/lib/lunr.js on lines 36..48

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

    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 get_annotated_classes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_annotated_classes(annotations, semantic_types=[])
        # Use batch service to get class prefLabels
        class_list = []
        annotations.each {|a| class_list << get_annotated_class_hash(a) }
        hierarchy = annotations.map {|a| a if a.keys.include? 'hierarchy' }.compact
    Severity: Minor
    Found in app/controllers/annotatorplus_controller.rb - About 2 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

    Method create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        start = Time.now
        input = params[:input].strip.gsub("\r\n", " ").gsub("\n", " ")
        # Default values are set at the service level)
        form_data = Hash.new
    Severity: Minor
    Found in app/controllers/recommender_controller.rb - About 2 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

    Method get_annotated_classes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_annotated_classes(annotations, semantic_types=[])
        # Use batch service to get class prefLabels
        class_list = []
        annotations.each {|a| class_list << get_annotated_class_hash(a) }
        hierarchy = annotations.map {|a| a if a.keys.include? 'hierarchy' }.compact
    Severity: Minor
    Found in app/controllers/annotator_controller.rb - About 2 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

    Function module has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        return function module(name, requires, configFn) {
          var assertNotHasOwnProperty = function(name, context) {
            if (name === 'hasOwnProperty') {
              throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
            }
    Severity: Major
    Found in public/browse/lib/angular-loader/angular-loader.js - About 2 hrs to fix

      Method json_search has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def json_search
          if params[:q].nil?
            render :text => "No search class provided"
            return
          end
      Severity: Major
      Found in app/controllers/search_controller.rb - About 2 hrs to fix

        File bp_property_tree.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
        * jQuery SimpleTree Drag&Drop plugin
        * Update on 22th May 2008
        * Version 0.3
        *
        Severity: Minor
        Found in app/assets/javascripts/bp_property_tree.js - About 2 hrs to fix

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

          function bindAddProposalClick() {
            jQuery("a.add_proposal").live('click', function(){
              var id = jQuery(this).attr("data-parent-id");
              var type = jQuery(this).attr("data-parent-type");
              addProposalBox(id, type, this);
          Severity: Major
          Found in app/assets/javascripts/bp_notes.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/bp_notes.js on lines 53..59

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

          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 bindAddCommentClick() {
            jQuery("a.add_comment").live('click', function(){
              var id = jQuery(this).attr("data-parent-id");
              var type = jQuery(this).attr("data-parent-type");
              addCommentBox(id, type, this);
          Severity: Major
          Found in app/assets/javascripts/bp_notes.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/bp_notes.js on lines 61..67

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

          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

          Function $LogProvider has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          angular.mock.$LogProvider = function() {
            var debug = true;
          
            function concat(array1, array2, index) {
              return array1.concat(Array.prototype.slice.call(array2, index));
          Severity: Major
          Found in public/browse/lib/angular-mocks/angular-mocks.js - About 2 hrs to fix

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

            lunr.Index.prototype.on = function () {
              var args = Array.prototype.slice.call(arguments)
              return this.eventEmitter.addListener.apply(this.eventEmitter, args)
            }
            Severity: Major
            Found in public/browse/lib/lunr.js/lunr.js and 1 other location - About 2 hrs to fix
            public/browse/lib/lunr.js/lib/index.js on lines 38..41

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

            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

            lunr.Index.prototype.on = function () {
              var args = Array.prototype.slice.call(arguments)
              return this.eventEmitter.addListener.apply(this.eventEmitter, args)
            }
            Severity: Major
            Found in public/browse/lib/lunr.js/lib/index.js and 1 other location - About 2 hrs to fix
            public/browse/lib/lunr.js/lunr.js on lines 818..821

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

            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

            Function keyListener has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  function keyListener(e) {
                    switch (e.keyCode) {
                      case 9:
                      case 27:
                      case 16:
            Severity: Minor
            Found in public/widgets/jquery.ncbo.autocomplete.js - About 1 hr to fix

              Function ajax_process_cls has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var ajax_process_cls = function() {
                // Check on whether to stop the ajax process
                if( ajax_cls_array.length === 0 ){
                  ajax_process_cls_halt();
                  return true;
              Severity: Minor
              Found in app/assets/javascripts/bp_ajax_controller.js - About 1 hr to fix

                Method create has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def create
                    params[:mappings] ||= []
                    params[:max_level] ||= 0
                    params[:ontologies] ||= []
                    params[:semantic_types] ||= []
                Severity: Minor
                Found in app/controllers/annotator_controller.rb - About 1 hr to fix

                  Function jumpTo_formatItem has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function jumpTo_formatItem(row) {
                      var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"), // .*+?|()[]{}\
                          keywords = jQuery(jumpTo_searchBoxSelector).val().trim().replace(specials, "\\$&").split(' ').join('|'),
                          regex = new RegExp('(' + keywords + ')', 'gi');
                      var resultTypeSpan = jQuery("<span>");
                  Severity: Minor
                  Found in public/javascripts/widgets/quick_jump.js - About 1 hr 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