Showing 22 of 36 total issues

File HomeView.js has 606 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * View Description
 * 
 * @langversion JavaScript
 * 
Severity: Major
Found in public.devel/app/views/HomeView.js - About 1 day to fix

    Function createGraph has 124 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            createGraph: function (){
    
               var self = this;
               var removing = false;           
               //Create a new ST instance
    Severity: Major
    Found in public.devel/app/views/HomeView.js - About 4 hrs to fix

      Function createGraph has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

              createGraph: function (){
      
                 var self = this;
                 var removing = false;           
                 //Create a new ST instance
      Severity: Minor
      Found in public.devel/app/views/HomeView.js - 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

      HomeView has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

       var HomeView = View.extend({
      
          /*
           * @private
           */
      Severity: Minor
      Found in public.devel/app/views/HomeView.js - About 3 hrs to fix

        File application.rb has 304 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'sinatra'
        # require 'sinatra_warden'
        
        require 'uri'
        require 'sanitize'
        Severity: Minor
        Found in lib/application.rb - About 3 hrs to fix

          Method get_concepts has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def get_concepts(type=nil,uri=nil, lang=nil, page=nil)
              
          
                  if uri.nil?
                    # return null to save resources
          Severity: Major
          Found in lib/application.rb - About 2 hrs to fix

            Function addSubtreeAndPagers has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

               addSubtreeAndPagers: function(nodeId, tree) {
               
                          var paginator_right = '_pag_r_' + nodeId;
                          var paginator_left = '_pag_l_' + nodeId;
                          var pag = this.idToLevelsPageNum[nodeId];
            Severity: Major
            Found in public.devel/app/views/HomeView.js - About 2 hrs to fix

              Method get_concepts has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_concepts(type=nil,uri=nil, lang=nil, page=nil)
                  
              
                      if uri.nil?
                        # return null to save resources
              Severity: Minor
              Found in lib/application.rb - 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

              Function initSearchBox has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                 initSearchBox: function(){
              
                              var sURL = '/api/getsimilarconcepts?lang='+this.currentLang
                              $("#selector").select2({
                                width: '100%',
              Severity: Minor
              Found in public.devel/app/views/HomeView.js - About 1 hr to fix

                Method get_concept has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def get_concept(uri=nil, lang=nil)
                    
                
                        if uri.nil?
                          # return null to save resources
                Severity: Minor
                Found in lib/application.rb - About 1 hr to fix

                  Function getNewSubtree has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                       getNewSubtree: function(nodeId) {
                  
                          var self = this;
                          var data, uri = '';
                              
                  Severity: Minor
                  Found in public.devel/app/views/HomeView.js - About 1 hr to fix

                    Function addIdsFromUris has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                       addIdsFromUris: function (tree) {
                    
                            var self = this;
                            var newTree = _.map(tree,function (obj) { 
                              
                    Severity: Minor
                    Found in public.devel/app/views/HomeView.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

                    Function paginateUpdate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                       paginateUpdate: function(parentNode, newSubtree) {
                       
                          var self = this;
                          
                          var node = self.graph.graph.getNode(parentNode);
                    Severity: Minor
                    Found in public.devel/app/views/HomeView.js - About 1 hr to fix

                      Method get_ontologies has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def get_ontologies(lang=nil)
                          
                              if lang.nil? || !lang.length == 2
                                lang = 'EN'
                              else
                      Severity: Minor
                      Found in lib/application.rb - About 1 hr to fix

                        Function customRenderingFunctionsInit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                                customRenderingFunctionsInit: function () {
                                      
                                   $jit.ST.Plot.NodeTypes.implement({
                                    'nodeline': {
                                      'render': function(node, canvas, animating) {
                        Severity: Minor
                        Found in public.devel/app/views/HomeView.js - About 35 mins 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 initializeScreen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          initializeScreen: function () {
                                   
                              var ua = navigator.userAgent;
                              var iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i);
                              var typeOfCanvas = typeof HTMLCanvasElement;
                        Severity: Minor
                        Found in public.devel/app/views/HomeView.js - About 35 mins 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

                        Avoid too many return statements within this method.
                        Open

                                 return encoder.encode({ :name=>ylabel, :id=>'', :uri=>uri.to_s, :pages=>pages, :page=>page, :related_count=>relateds_count, :children=>parents_list, :related=>relateds_list })
                        Severity: Major
                        Found in lib/application.rb - About 30 mins to fix

                          Method get_similar_concepts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def get_similar_concepts(term=nil, lang=nil)
                              
                                if term.nil?
                                  # save resources and return null
                                  return encoder.encode({})
                          Severity: Minor
                          Found in lib/application.rb - About 25 mins 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_concept has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def get_concept(uri=nil, lang=nil)
                              
                          
                                  if uri.nil?
                                    # return null to save resources
                          Severity: Minor
                          Found in lib/application.rb - About 25 mins 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 paginate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                             paginate: function(node, fx) {
                          
                                var parentNode = this.computeParentNode(node);
                                var subtree;
                                
                          Severity: Minor
                          Found in public.devel/app/views/HomeView.js - About 25 mins 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