ucsdlib/damspas

View on GitHub
lib/dams/dams_object.rb

Summary

Maintainability
F
1 wk
Test Coverage

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

    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 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 insertFileFields has a Cognitive Complexity of 30 (exceeds 5 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 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 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 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 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 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 insertSubjectsGraph has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def insertSubjectsGraph
                if(!@subURI.nil?)
                    if(@subURI.class == Array)
                        @subURI.each do |sub|
                            graph.insert([rdf_subject, DAMS.complexSubject, sub])
        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 find_parents has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def find_parents( solr_doc, col )
                begin
                  col.assembledCollection.each do |acol|
                    cpid = (acol.respond_to? :pid) ? acol.pid : acol.to_s.gsub(/.*\//,'')
                    parent_obj = DamsAssembledCollection.find(cpid)
        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 insertNameGraph has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def insertNameGraph  
                if(!@nameURI.nil?)
                    if(@nameURI.class == Array)
                        @nameURI.each do |nam|
                            graph.insert([rdf_subject, DAMS.name, nam])
        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

        Consider simplifying this complex logical expression.
        Open

                  c if (c == 0x9 || c == 0xA || c == 0xD || (c >= 0x20 && c <= 0xD7FF) ||
                       (c >= 0xE000 && c <= 0xFFFD) || (c >= 0x10000 && c <= 0x10FFFF) )
        Severity: Critical
        Found in lib/dams/dams_object.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 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 insertOtherRightsFields has 33 lines of code (exceeds 25 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 1 hr to fix

              Method insertCopyRightsInfoGraph has 28 lines of code (exceeds 25 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 1 hr to fix

                Method insertNameGraph has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def insertNameGraph  
                        if(!@nameURI.nil?)
                            if(@nameURI.class == Array)
                                @nameURI.each do |nam|
                                    graph.insert([rdf_subject, DAMS.name, nam])
                Severity: Minor
                Found in lib/dams/dams_object.rb - About 1 hr to fix

                  Method insertSubjectsGraph has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def insertSubjectsGraph
                          if(!@subURI.nil?)
                              if(@subURI.class == Array)
                                  @subURI.each do |sub|
                                      graph.insert([rdf_subject, DAMS.complexSubject, sub])
                  Severity: Minor
                  Found in lib/dams/dams_object.rb - About 1 hr to fix

                    Method fulltext has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def fulltext( object, file, cid )
                            mime_type = file.mimeType.first.to_s.gsub(/;.*/,"").gsub(/\s.*/,"").gsub(/\..*/,"")
                            fid = (cid != nil) ? "_#{cid}_#{file.id}" : "_" + file.id
                            if ["application/pdf", "text/html", "text/plain", "application/msword", "application/vnd"].include?(mime_type) || fid.end_with?(".doc", ".docx", ".xls",".xlsx")
                              fid = extracted_text(fid)
                    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 escape_text has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def escape_text( text )
                            text.encode('utf-8', replace: ' ').each_codepoint do |c|
                              c if (c == 0x9 || c == 0xA || c == 0xD || (c >= 0x20 && c <= 0xD7FF) ||
                                   (c >= 0xE000 && c <= 0xFFFD) || (c >= 0x10000 && c <= 0x10FFFF) )
                            end
                    Severity: Minor
                    Found in lib/dams/dams_object.rb - About 55 mins 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 insertRightsHolderGraph has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def insertRightsHolderGraph       
                            if(!@holderURI.nil?)
                                if(@holderURI.class == Array)
                                    i = 0
                                    @holderURI.each do |holder|
                    Severity: Minor
                    Found in lib/dams/dams_object.rb - About 35 mins 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 5 locations. Consider refactoring.
                    Open

                          def insertNameGraph  
                            if(!@nameURI.nil?)
                                if(@nameURI.class == Array)
                                    @nameURI.each do |nam|
                                        graph.insert([rdf_subject, DAMS.name, nam])
                    Severity: Major
                    Found in lib/dams/dams_object.rb and 4 other locations - About 3 hrs to fix
                    lib/dams/dams_object.rb on lines 205..231
                    lib/dams/provenance_collection.rb on lines 157..183
                    lib/dams/provenance_collection.rb on lines 189..215
                    lib/dams/provenance_collection_part.rb on lines 145..171

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

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

                          def insertSubjectsGraph
                            if(!@subURI.nil?)
                                if(@subURI.class == Array)
                                    @subURI.each do |sub|
                                        graph.insert([rdf_subject, DAMS.complexSubject, sub])
                    Severity: Major
                    Found in lib/dams/dams_object.rb and 4 other locations - About 3 hrs to fix
                    lib/dams/dams_object.rb on lines 237..263
                    lib/dams/provenance_collection.rb on lines 157..183
                    lib/dams/provenance_collection.rb on lines 189..215
                    lib/dams/provenance_collection_part.rb on lines 145..171

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

                    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

                              othr_json = {
                                :id => othr.pid,
                                :basis => othr.basis.first.to_s,
                                :note => othr.note.first.to_s,
                                :uri => othr.uri.first.to_s,
                    Severity: Major
                    Found in lib/dams/dams_object.rb and 1 other location - About 1 hr to fix
                    lib/dams/dams_object.rb on lines 453..463

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

                    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

                              stat_json = {
                                :id => stat.pid,
                                :citation => stat.citation.first.to_s,
                                :jurisdiction => stat.jurisdiction.first.to_s,
                                :note => stat.note.first.to_s,
                    Severity: Major
                    Found in lib/dams/dams_object.rb and 1 other location - About 1 hr to fix
                    lib/dams/dams_object.rb on lines 471..481

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

                    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

                            begin
                              col.assembledCollection.each do |acol|
                                cpid = (acol.respond_to? :pid) ? acol.pid : acol.to_s.gsub(/.*\//,'')
                                parent_obj = DamsAssembledCollection.find(cpid)
                                ptitle = parent_obj.title.first.value
                    Severity: Minor
                    Found in lib/dams/dams_object.rb and 1 other location - About 1 hr to fix
                    lib/dams/dams_object.rb on lines 735..745

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

                    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

                            begin
                              col.provenanceCollection.each do |pcol|
                                cpid = (pcol.respond_to? :pid) ? pcol.pid : pcol.to_s.gsub(/.*\//,'')
                                parent_obj = DamsProvenanceCollection.find(cpid)
                                ptitle = parent_obj.title.first.value
                    Severity: Minor
                    Found in lib/dams/dams_object.rb and 1 other location - About 1 hr to fix
                    lib/dams/dams_object.rb on lines 724..734

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

                    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 othr.relationship.first != nil && othr.relationship.first.personalName.first != nil
                                othr_json[:name] = "#{Rails.configuration.id_namespace}#{othr.relationship.first.personalName.first.pid}"
                              end
                    Severity: Minor
                    Found in lib/dams/dams_object.rb and 1 other location - About 25 mins to fix
                    lib/dams/dams_object.rb on lines 489..491

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

                    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 othr.relationship.first != nil && othr.relationship.first.corporateName.first != nil
                                othr_json[:name] = "#{Rails.configuration.id_namespace}#{othr.relationship.first.corporateName.first.pid}"
                              end
                    Severity: Minor
                    Found in lib/dams/dams_object.rb and 1 other location - About 25 mins to fix
                    lib/dams/dams_object.rb on lines 486..488

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status