ucsdlib/damspas

View on GitHub

Showing 388 of 388 total issues

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

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

      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

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

              } else if( isId == false && $("."+id).val().indexOf("Create New") >= 0) {
              if(type.indexOf("mads") < 0 && type.indexOf("dams") < 0) {    
                type = getObjectsPath(type);
              } 
                target_popup(baseURL.replace("get_data","")+type+"/new?parent_class="+id);
            Severity: Major
            Found in app/assets/javascripts/edit.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/edit.js on lines 567..577

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

            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( isId == true && $("#"+id).val().indexOf("Create New") >= 0) {
              if(type.indexOf("mads") < 0 && type.indexOf("dams") < 0) {    
                type = getObjectsPath(type);
              }  
                target_popup(baseURL.replace("get_data","")+type+"/new?parent_id="+id);
            Severity: Major
            Found in app/assets/javascripts/edit.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/edit.js on lines 572..577

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

            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 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_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_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_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

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

                      if !object.name[0].nil?
                            id = object.name.to_s.gsub(/.*\//,'')[0..9]          
                        elsif !object.conferenceName[0].nil?
                            id = object.conferenceName.to_s.gsub(/.*\//,'')[0..9]          
                        elsif !object.corporateName[0].nil?
              Severity: Major
              Found in lib/dams/controller_helper.rb and 1 other location - About 2 hrs to fix
              lib/dams/controller_helper.rb on lines 396..406

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

              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

                        elsif !object.technique[0].nil?
                            id = object.technique.to_s.gsub(/.*\//,'')[0..9]
                        elsif !object.lithology[0].nil?
                            id = object.lithology.to_s.gsub(/.*\//,'')[0..9]
                        elsif !object.series[0].nil?
              Severity: Major
              Found in lib/dams/controller_helper.rb and 1 other location - About 2 hrs to fix
              lib/dams/controller_helper.rb on lines 578..588

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

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

                  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
                      Severity
                      Category
                      Status
                      Source
                      Language