ucsdlib/damspas

View on GitHub

Showing 226 of 388 total issues

Method get_name has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

 def get_name   
    #http://localhost:3000/get_data/get_name/get_name?q=PersonalName&formType=dams_object
    type = nil;
    if(!params[:q].nil? && params[:q] != '' && (params[:q].include? 'Corporate'))
      type = 'MadsCorporateName'    
Severity: Minor
Found in app/controllers/get_data_controller.rb - About 1 hr to fix

    Method insertFileFields has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def insertFileFields( solr_doc, cid, files )
            prefix = (cid != nil) ? "component_#{cid}_" : ""
            files.map.sort{ |a,b| a.order <=> b.order }.each { |file|
        
              # basic file info
    Severity: Minor
    Found in lib/dams/dams_object.rb - About 1 hr to fix

      Method create_derivatives has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def create_derivatives(object, file, fullPath)
            if file.nil? || !file.respond_to?(:original_filename)
              return { alert: "No file uploaded" }
            else       
            begin
      Severity: Minor
      Found in lib/dams/controller_helper.rb - About 1 hr to fix

        Function removeEmptyFields has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function removeEmptyFields() {
          var inputElements= document.getElementsByClassName("input-block-level");
          var fieldId = "";
          var inputElementsArray = new Array();
          for (var i=0;i<inputElements.length;i++) {
        Severity: Minor
        Found in app/assets/javascripts/edit.js - About 1 hr to fix

          Method get_creators has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def get_creators(object)       
                  creatorArray = Array.new
          
                    object.conferenceName.each do |conf|
                      creatorArray << {
          Severity: Minor
          Found in lib/dams/controller_helper.rb - About 1 hr to fix

            Function getEditDynamicFields has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getEditDynamicFields(link,type,location,typeName)
            {  
              var q = link.value;
              var typeGet = null;
              var reg = null;
            Severity: Minor
            Found in app/assets/javascripts/edit.js - About 1 hr to fix

              Method insertRelationshipFields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def insertRelationshipFields ( solr_doc, prefix, relationships )
              
                  facetable = Solrizer::Descriptor.new(:string, :indexed, :multivalued)
                  # build map: role => [name1,name2]
                  rels = {}
              Severity: Minor
              Found in app/models/datastreams/dams_resource_datastream.rb - About 1 hr to fix

                Method transform_unit_scope has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def transform_unit_scope(solr_parameters,params)
                    if ((params[:f].nil? || params[:f][:type_sim].nil? || !params[:f][:type_sim].include?('Collection')) && params[:fq] && params[:action] != "collection_search")
                      params[:fq].each do |f|
                        if f.start_with?('{!join from=collections_tesim to=id}unit_code_tesim:')
                          # remove query from filters
                Severity: Minor
                Found in app/controllers/catalog_controller.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

                Method get_value has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def get_value(name)
                        el = elementList
                        idx = 0
                        while idx < el.size
                          elem = el[idx]
                Severity: Minor
                Found in lib/dams/mads_conference_name.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

                Method osf_date_published has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    def osf_date_published(document)
                      dams_data = document['date_json_tesim']
                      osf_data = ''
                
                      unless dams_data.nil?
                Severity: Minor
                Found in lib/dams/controller_helper.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

                Method get_name has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                 def get_name   
                    #http://localhost:3000/get_data/get_name/get_name?q=PersonalName&formType=dams_object
                    type = nil;
                    if(!params[:q].nil? && params[:q] != '' && (params[:q].include? 'Corporate'))
                      type = 'MadsCorporateName'    
                Severity: Minor
                Found in app/controllers/get_data_controller.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

                Method get_value has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def get_value(name)
                        el = elementList
                        idx = 0
                        while idx < el.size
                          elem = el[idx]
                Severity: Minor
                Found in lib/dams/mads_corporate_name.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

                Method osf_title has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    def osf_title(document)
                      dams_data = document['title_json_tesim']
                      osf_data = ''
                      unless dams_data.nil?
                        dams_data.each do |datum|
                Severity: Minor
                Found in lib/dams/controller_helper.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

                Method get_objects has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_objects(object_type_param,field)
                          @doc = get_search_results(:q => "has_model_ssim:info:fedora/afmodel:#{object_type_param}", :rows => '10000')
                          @objects = Array.new
                          @doc.each do |col| 
                            if col.class == Array
                Severity: Minor
                Found in lib/dams/controller_helper.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

                Method get_value has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def get_value(name)
                        el = elementList
                        idx = 0
                        while idx < el.size
                          elem = el[idx]
                Severity: Minor
                Found in lib/dams/mads_family_name.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

                Method get_value has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def get_value(name)
                        el = elementList
                        idx = 0
                        while idx < el.size
                          elem = el[idx]
                Severity: Minor
                Found in lib/dams/mads_personal_name.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

                Method get_value has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def get_value(name)
                        el = elementList
                        idx = 0
                        while idx < el.size
                          elem = el[idx]
                Severity: Minor
                Found in lib/dams/mads_name.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

                Method load_unit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def load_unit(unit)
                        if !unit.first.nil?
                            u_pid = unit.first.pid
                            
                            if !unit.first.name.first.nil? && unit.first.name.first.to_s.length > 0
                Severity: Minor
                Found in lib/dams/dams_object.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

                Method get_simple_subject_value has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def get_simple_subject_value(object)
                        value = ""
                        if !object.temporal[0].nil?   
                              value = object.temporal.first.name.first
                          elsif !object.topic[0].nil?
                Severity: Minor
                Found in lib/dams/controller_helper.rb - About 1 hr to fix

                  Method get_simple_subject_type has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def get_simple_subject_type(object)
                          type = ""
                             if !object.temporal[0].nil?
                                type = "MadsTemporal" 
                            elsif !object.topic[0].nil?
                  Severity: Minor
                  Found in lib/dams/controller_helper.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language