ucsdlib/damspas

View on GitHub

Showing 388 of 388 total issues

File controller_helper.rb has 850 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Dams
  module ControllerHelper
    
    #Mapping for OSF API
    def osf_title(document)
Severity: Major
Found in lib/dams/controller_helper.rb - About 2 days to fix

    File dams_helper.rb has 752 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'active_support/inflector'
    
    module Dams
        module DamsHelper
            
    Severity: Major
    Found in lib/dams/dams_helper.rb - About 1 day to fix

      File dams_resource_datastream.rb has 690 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'timeout'
      
      class DamsResourceDatastream < ActiveFedora::RdfxmlRDFDatastream
        include Dams::DamsHelper
        rdf_subject { |ds|
      Severity: Major
      Found in app/models/datastreams/dams_resource_datastream.rb - About 1 day to fix

        Class DamsResourceDatastream has 79 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class DamsResourceDatastream < ActiveFedora::RdfxmlRDFDatastream
          include Dams::DamsHelper
          rdf_subject { |ds|
            if ds.pid.nil?
              RDF::URI.new
        Severity: Major
        Found in app/models/datastreams/dams_resource_datastream.rb - About 1 day to fix

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

          module Dams
            module MadsPersonalName
              extend ActiveSupport::Concern
              include Dams::MadsSimpleType
              include Dams::MadsNameElements
          Severity: Major
          Found in lib/dams/mads_personal_name.rb and 3 other locations - About 1 day to fix
          lib/dams/mads_conference_name.rb on lines 3..126
          lib/dams/mads_corporate_name.rb on lines 3..127
          lib/dams/mads_family_name.rb on lines 3..126

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

          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 4 locations. Consider refactoring.
          Open

          module Dams
            module MadsCorporateName
              extend ActiveSupport::Concern
              include Dams::MadsSimpleType
              include Dams::MadsNameElements
          Severity: Major
          Found in lib/dams/mads_corporate_name.rb and 3 other locations - About 1 day to fix
          lib/dams/mads_conference_name.rb on lines 3..126
          lib/dams/mads_family_name.rb on lines 3..126
          lib/dams/mads_personal_name.rb on lines 3..126

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

          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 4 locations. Consider refactoring.
          Open

          module Dams
            module MadsConferenceName
              extend ActiveSupport::Concern
              include Dams::MadsSimpleType
              include Dams::MadsNameElements
          Severity: Major
          Found in lib/dams/mads_conference_name.rb and 3 other locations - About 1 day to fix
          lib/dams/mads_corporate_name.rb on lines 3..127
          lib/dams/mads_family_name.rb on lines 3..126
          lib/dams/mads_personal_name.rb on lines 3..126

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

          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 4 locations. Consider refactoring.
          Open

          module Dams
            module MadsFamilyName
              extend ActiveSupport::Concern
              include Dams::MadsSimpleType
              include Dams::MadsNameElements
          Severity: Major
          Found in lib/dams/mads_family_name.rb and 3 other locations - About 1 day to fix
          lib/dams/mads_conference_name.rb on lines 3..126
          lib/dams/mads_corporate_name.rb on lines 3..127
          lib/dams/mads_personal_name.rb on lines 3..126

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

          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

          File dams_object.rb has 645 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'active_support/concern'
          require 'date'
          
          module Dams
            module DamsObject
          Severity: Major
          Found in lib/dams/dams_object.rb - About 1 day to fix

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

                this.initPolygon = function()
                {
                    var points = data.coords.split(" ");
                    for ( i = 0; i < points.length; i++ )
                    {
            Severity: Major
            Found in app/assets/javascripts/views-object.js and 1 other location - About 1 day to fix
            app/assets/javascripts/views-object.js on lines 59..71

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

            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

                this.initLine = function()
                {
                    var points = data.coords.split(" ");
                    for ( i = 0; i < points.length; i++ )
                    {
            Severity: Major
            Found in app/assets/javascripts/views-object.js and 1 other location - About 1 day to fix
            app/assets/javascripts/views-object.js on lines 76..88

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

            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

            File edit.js has 534 lines of code (exceeds 250 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 1 day to fix

              File dams_objects_helper.rb has 524 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "base64"
              require "openssl"
              
              module DamsObjectsHelper
                include Dams::ControllerHelper
              Severity: Major
              Found in app/helpers/dams_objects_helper.rb - About 1 day to fix

                Method to_solr has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                Open

                      def to_solr (solr_doc = {})
                        super(solr_doc)
                    
                        @facetable = Solrizer::Descriptor.new(:string, :indexed, :multivalued)
                        singleString = Solrizer::Descriptor.new(:string, :indexed, :stored)
                Severity: Minor
                Found in lib/dams/dams_object.rb - About 7 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 to_solr has 170 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def to_solr (solr_doc = {})
                        super(solr_doc)
                    
                        @facetable = Solrizer::Descriptor.new(:string, :indexed, :multivalued)
                        singleString = Solrizer::Descriptor.new(:string, :indexed, :stored)
                Severity: Major
                Found in lib/dams/dams_object.rb - About 6 hrs to fix

                  Method show has a Cognitive Complexity of 43 (exceeds 5 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: Minor
                  Found in app/controllers/dams_resource_controller.rb - About 6 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 a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def events_to_json( event )
                      event_array = []
                      events = load_events event
                      if events != nil
                        n = 0
                  Severity: Minor
                  Found in app/models/datastreams/dams_resource_datastream.rb - About 6 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 insertRelationship has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def insertRelationship ( solr_doc, prefix, relationships )
                      
                          # build map: role => [name1,name2]
                          rels = {}
                          relationships.map do |relationship|
                  Severity: Minor
                  Found in lib/dams/dams_other_right.rb - About 6 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 a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def serialize
                          check_type( graph, rdf_subject, DAMS.Object )
                  
                          if(!@unitURI.nil?)
                            if new?
                  Severity: Minor
                  Found in lib/dams/dams_object.rb - About 5 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 a Cognitive Complexity of 38 (exceeds 5 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: Minor
                  Found in lib/dams/provenance_collection.rb - About 5 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

                  Severity
                  Category
                  Status
                  Source
                  Language