ucsdlib/damspas

View on GitHub

Showing 226 of 388 total issues

Method setElementValue has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

      def setElementValue(type,val)
        if val.class == Array
            val = val.first
        end

Severity: Minor
Found in lib/dams/dams_helper.rb - 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

Method dateHelper has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

  def dateHelper dates
    dateRet = ''
    c2 = false
    c3 = false
    c4 = false
Severity: Minor
Found in app/helpers/application_helper.rb - 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

Method custom_permissions has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def custom_permissions

    can [:solr], :all
    def create_permissions
      #can :create, :all if user_groups.include? 'registered'
Severity: Major
Found in app/models/ability.rb - About 4 hrs to fix

    Method serialize has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

          def serialize
            check_type( graph, rdf_subject, DAMS.AssembledCollection )
            if(!@unitURI.nil?)
              if new?
                graph.insert([rdf_subject, DAMS.unit, @unitURI])
    Severity: Minor
    Found in lib/dams/assembled_collection.rb - About 3 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_dams_data has a Cognitive Complexity of 25 (exceeds 5 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 3 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 show has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def show
        refcon = referrer_controller request
        if params[:counter]
          # if there is a counter, update pager state & redirect to no-counter view
          logger.info "dams_resource_controller#show (#{refcon}) adding query to session and redirecting"
    Severity: Major
    Found in app/controllers/dams_resource_controller.rb - About 3 hrs to fix

      Method insertCopyRightsInfoGraph has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

            def insertCopyRightsInfoGraph
              if(!@rightURI.nil?)
                if new?
                  graph.insert([rdf_subject, DAMS.copyright, @rightURI])
                else
      Severity: Minor
      Found in lib/dams/dams_object.rb - About 3 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_subjects has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def get_simple_subjects(object)       
              simpleSubjectArray = Array.new
      
           
      
      
      Severity: Major
      Found in lib/dams/controller_helper.rb - About 3 hrs to fix

        Method load_collection has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

              def load_collection (collection,assembledCollection,provenanceCollection,provenanceCollectionPart)
                collections = []
                [collection,assembledCollection,provenanceCollection,provenanceCollectionPart].each do |coltype|
                  coltype.each do |col|
                    begin
        Severity: Minor
        Found in lib/dams/dams_object.rb - About 3 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 authLabel has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

              def authLabel
                main = value
                subt = subtitle
                nons = nonSort
                pnam = partName
        Severity: Minor
        Found in lib/dams/mads_title.rb - About 3 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_derivatives has a Cognitive Complexity of 21 (exceeds 5 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 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_related_resource_url has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_related_resource_url(object_type_param,field1,field2)
                  @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 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

        Class DamsObject has 25 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class DamsObject < ActiveFedora::Base
          include Hydra::AccessControls::Permissions
          include Hydra::ModelMethods
          has_metadata 'damsMetadata', :type => DamsObjectDatastream
          has_attributes :assembledCollection_attributes,
        Severity: Minor
        Found in app/models/dams_object.rb - About 2 hrs to fix

          Method date_list has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def date_list( document )
              dateVal = ''
              dates = document['date_json_tesim']
              if dates != nil
                dates.each do |txt|
          Severity: Minor
          Found in app/helpers/catalog_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 insertTitleFields has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def insertTitleFields ( solr_doc, cid, titles )
              sort_title = ""
              titles.each do |t|
                begin
                  if(t.name.class == ActiveFedora::RdfNode::TermProxy)
          Severity: Major
          Found in app/models/datastreams/dams_resource_datastream.rb - About 2 hrs to fix

            Method to_solr has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def to_solr (solr_doc = {})
                super(solr_doc)
            
                facetable = Solrizer::Descriptor.new(:string, :indexed, :multivalued)
            
            
            Severity: Major
            Found in app/models/datastreams/dams_resource_datastream.rb - About 2 hrs to fix

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

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

                Method show has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  def show
                    # load metadata
                    start = Time.now.to_f
                    begin
                      objid = params[:id]
                Severity: Minor
                Found in app/controllers/file_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 loadRdfObjects has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  def loadRdfObjects (object, className, reload = true)
                    objects = []
                    if !object.first.nil?
                      object.each do |o|
                        o_pid = o.pid;
                Severity: Minor
                Found in lib/dams/dams_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

                Function getAutocompleteList_callback has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getAutocompleteList_callback(formtype,fieldname,elementID,elementLabel){
                    
                    
                    var IDTag='#'+elementID;
                    var typeaheadLabelTag='#'+elementLabel+'.typeahead';
                Severity: Major
                Found in app/assets/javascripts/edit.js - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language