ucsdlib/damspas

View on GitHub

Showing 226 of 388 total issues

Method show has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def show
    # load metadata
    start = Time.now.to_f
    begin
      objid = params[:id]
Severity: Major
Found in app/controllers/file_controller.rb - About 2 hrs to fix

    Method setElementValue has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def setElementValue(type,val)
            if val.class == Array
                val = val.first
            end
    
    
    Severity: Major
    Found in lib/dams/dams_helper.rb - About 2 hrs to fix

      Function processForm_generic has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      function processForm_generic(objType) {
          
          var attributesArray =new Array("assembledCollection","provenanceCollection","provenanceCollectionPart","complexSubject","statute","license","copyright","language","unit","rightsHolderPersonal");
          fieldId = "";
          for (var j in attributesArray) {
      Severity: Minor
      Found in app/assets/javascripts/edit.js - 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 insertRelationshipFields has a Cognitive Complexity of 18 (exceeds 5 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 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 insertOtherRightsFields has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

            def insertOtherRightsFields( solr_doc, prefix, otherRights )
              othr = load_otherRights otherRights
              if othr != nil
                othr_json = {
                  :id => othr.pid,
      Severity: Minor
      Found in lib/dams/dams_object.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 showComponent has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          this.showComponent = function(componentIndex)
          {
      
              var componentID = "#component-" + componentIndex;
              var container = componentID + " > [data]";
      Severity: Major
      Found in app/assets/javascripts/views-object.js - About 2 hrs to fix

        Method events_to_json has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def events_to_json( event )
            event_array = []
            events = load_events event
            if events != nil
              n = 0
        Severity: Major
        Found in app/models/datastreams/dams_resource_datastream.rb - About 2 hrs to fix

          Function processForm_generic has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function processForm_generic(objType) {
              
              var attributesArray =new Array("assembledCollection","provenanceCollection","provenanceCollectionPart","complexSubject","statute","license","copyright","language","unit","rightsHolderPersonal");
              fieldId = "";
              for (var j in attributesArray) {
          Severity: Major
          Found in app/assets/javascripts/edit.js - About 2 hrs to fix

            Method serialize has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def serialize
                    check_type( graph, rdf_subject, DAMS.ProvenanceCollection )
                    if(!@unitURI.nil?)
                      if new?
                        graph.insert([rdf_subject, DAMS.unit, @unitURI])
            Severity: Major
            Found in lib/dams/provenance_collection.rb - About 2 hrs to fix

              Function getDynamicFields has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getDynamicFields(link,type,location,fieldId,typeName,selectedValue,relationship,selectedRole)
              {  
                var q = null;
                var fieldName = null;
                var typeGet = null;
              Severity: Major
              Found in app/assets/javascripts/edit.js - About 2 hrs to fix

                Method insertRelationship has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def insertRelationship ( solr_doc, prefix, relationships )
                    
                        # build map: role => [name1,name2]
                        rels = {}
                        relationships.map do |relationship|
                Severity: Major
                Found in lib/dams/dams_other_right.rb - About 2 hrs to fix

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

                      def get_simple_subject_id(object)
                          id = ""
                          if !object.temporal[0].nil?   
                                id = object.temporal.to_s.gsub(/.*\//,'')[0..9]
                            elsif !object.topic[0].nil?
                  Severity: Minor
                  Found in lib/dams/controller_helper.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_simple_subject_value has a Cognitive Complexity of 16 (exceeds 5 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 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 serialize has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def serialize
                            check_type( graph, rdf_subject, DAMS.ProvenanceCollectionPart )
                            if(!@unitURI.nil?)
                              if new?
                                graph.insert([rdf_subject, DAMS.unit, @unitURI])
                  Severity: Major
                  Found in lib/dams/provenance_collection_part.rb - About 2 hrs to fix

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

                    function getTypeaheadFields(linkTag,formType,location,fieldId,typeName,selectedValue,selectedLabel)
                    {  
                      
                      var q = null;
                      var fieldName = null;
                    Severity: Major
                    Found in app/assets/javascripts/edit.js - About 2 hrs to fix

                      Method insertDateFields has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def insertDateFields (solr_doc, cid, dates)
                          date_begin = nil
                          date_end = nil
                          date_val = nil
                      
                      
                      Severity: Minor
                      Found in app/models/datastreams/dams_resource_datastream.rb - About 2 hrs to fix

                        Function getMultiAutoCompleteList has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function getMultiAutoCompleteList(fieldName){ 
                        
                         var subjectLocal = new Bloodhound({
                            datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
                            queryTokenizer: Bloodhound.tokenizers.whitespace,
                        Severity: Minor
                        Found in app/assets/javascripts/edit.js - About 1 hr to fix

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

                            def get_dams_data
                          
                                if(!params[:q].nil? && params[:q] != '' && params[:q] == 'Topic')
                                  @docs = get_objects_json('MadsTopic','name_tesim')
                                elsif(!params[:q].nil? && params[:q] != '' && params[:q] == 'BuiltWorkPlace')
                          Severity: Minor
                          Found in app/controllers/get_data_controller.rb - About 1 hr to fix

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

                              def select_file( params )
                                document  = params[:document]
                                component = params[:component]
                                max_size  = params[:quality]
                                type      = params[:type]
                            Severity: Minor
                            Found in app/helpers/dams_objects_helper.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language