ucsdlib/damspas

View on GitHub
lib/dams/controller_helper.rb

Summary

Maintainability
F
1 wk
Test Coverage

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

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

      Method get_simple_subject_type has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_simple_subject_type(object)
              type = ""
                 if !object.temporal[0].nil?
                    type = "MadsTemporal" 
                elsif !object.topic[0].nil?
      Severity: Minor
      Found in lib/dams/controller_helper.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method get_simple_subject_id has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_simple_subject_id(object)
              id = ""
              if !object.temporal[0].nil?   
                    id = object.temporal.to_s.gsub(/.*\//,'')[0..9]
                elsif !object.topic[0].nil?
      Severity: Minor
      Found in lib/dams/controller_helper.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method get_simple_subject_value has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_simple_subject_value(object)
              value = ""
              if !object.temporal[0].nil?   
                    value = object.temporal.first.name.first
                elsif !object.topic[0].nil?
      Severity: Minor
      Found in lib/dams/controller_helper.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method get_relationships has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def get_relationships(object)       
              relationshipArray = Array.new
              relationship = object.relationship
              roleId = ""
              if(!relationship.nil?)
      Severity: Minor
      Found in lib/dams/controller_helper.rb - About 1 hr to fix

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

          Method get_creators has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def get_creators(object)       
                  creatorArray = Array.new
          
                    object.conferenceName.each do |conf|
                      creatorArray << {
          Severity: Minor
          Found in lib/dams/controller_helper.rb - About 1 hr to fix

            Method osf_date_published has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def osf_date_published(document)
                  dams_data = document['date_json_tesim']
                  osf_data = ''
            
                  unless dams_data.nil?
            Severity: Minor
            Found in lib/dams/controller_helper.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 osf_title has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def osf_title(document)
                  dams_data = document['title_json_tesim']
                  osf_data = ''
                  unless dams_data.nil?
                    dams_data.each do |datum|
            Severity: Minor
            Found in lib/dams/controller_helper.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 get_objects has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_objects(object_type_param,field)
                      @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 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 get_simple_subject_value has 35 lines of code (exceeds 25 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 1 hr to fix

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

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

                  Method get_rights_holders has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                     def get_rights_holders(object)       
                          rightsHolderArray = Array.new
                  
                            object.rightsHolderConference.each do |conf|
                              rightsHolderArray << {
                  Severity: Minor
                  Found in lib/dams/controller_helper.rb - About 1 hr to fix

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

                      Method attach_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def attach_file(object, file)
                            if file.nil? || !file.respond_to?(:original_filename)
                              return { alert: "No file uploaded" }
                            else
                              # set the filename
                      Severity: Minor
                      Found in lib/dams/controller_helper.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 get_relationship_name_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get_relationship_name_type(object)
                              type = ""
                              if(!object.relationshipNameURI.nil? && !object.relationshipNameURI.nil? && object.relationshipNameURI.class != Array)
                                    if(!object.relationshipNameURI.personalName.nil? && !object.relationshipNameURI.personalName.empty?)
                                        type = "PersonalName"
                      Severity: Minor
                      Found in lib/dams/controller_helper.rb - About 45 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 get_relationship_name_id has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get_relationship_name_id(object)
                              if(!object.relationshipNameURI.nil? && !object.relationshipNameURI.nil? && object.relationshipNameURI.class != Array)
                                    if(!object.relationshipNameURI.personalName.nil? && !object.relationshipNameURI.personalName.empty?)
                                        object.relationshipNameURI.personalName.to_s.gsub(/.*\//,'')[0..9]
                                    elsif(!object.relationshipNameURI.name.empty?)
                      Severity: Minor
                      Found in lib/dams/controller_helper.rb - About 45 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

                      Avoid too many return statements within this method.
                      Open

                                return { alert: e.to_s}
                      Severity: Major
                      Found in lib/dams/controller_helper.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                   return { alert: json['message'] }
                        Severity: Major
                        Found in lib/dams/controller_helper.rb - About 30 mins to fix

                          Method get_objects_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def get_objects_json(object_type_param,field)
                                    @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 25 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 get_linked_object_label has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                           def get_linked_object_label(id)
                                    @doc = get_search_results(:q => "id:#{id}")
                                    field = "name_tesim";
                                  
                                  @doc.each do |col| 
                          Severity: Minor
                          Found in lib/dams/controller_helper.rb - About 25 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 get_objects_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def get_objects_url(object_type_param,field)
                                    @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 25 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 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

                          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?
                                        value = object.technique.first.name.first                              
                                    elsif !object.lithology[0].nil?
                                        value = object.lithology.first.name.first
                                    elsif !object.series[0].nil?
                          Severity: Major
                          Found in lib/dams/controller_helper.rb and 1 other location - About 1 hr to fix
                          lib/dams/controller_helper.rb on lines 594..604

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

                          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 !object.name[0].nil?
                                        value = object.name.first.name.first          
                                    elsif !object.conferenceName[0].nil?
                                        value = object.conferenceName.first.name.first          
                                    elsif !object.corporateName[0].nil?
                          Severity: Major
                          Found in lib/dams/controller_helper.rb and 1 other location - About 1 hr to fix
                          lib/dams/controller_helper.rb on lines 434..444

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

                          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?
                                        type = "DamsTechnique"
                                    elsif !object.lithology[0].nil?
                                        type = "DamsLithology"
                                    elsif !object.series[0].nil?
                          Severity: Minor
                          Found in lib/dams/controller_helper.rb and 1 other location - About 55 mins to fix
                          lib/dams/controller_helper.rb on lines 562..572

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

                          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 !object.name[0].nil?
                                        type = "Name"           
                                    elsif !object.conferenceName[0].nil?
                                        type = "ConferenceName"           
                                    elsif !object.corporateName[0].nil?
                          Severity: Minor
                          Found in lib/dams/controller_helper.rb and 1 other location - About 55 mins to fix
                          lib/dams/controller_helper.rb on lines 358..368

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

                          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