archivesspace/archivesspace

View on GitHub

Showing 964 of 2,469 total issues

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

  Endpoint.delete('/repositories/:repo_id/resources/:id')
    .description("Delete a Resource")
    .params(["id", :id],
            ["repo_id", :repo_id])
    .permissions([:delete_archival_record])
Severity: Major
Found in backend/app/controllers/resource.rb and 10 other locations - About 15 mins to fix
backend/app/controllers/accession.rb on lines 68..75
backend/app/controllers/assessment.rb on lines 51..58
backend/app/controllers/classification.rb on lines 55..62
backend/app/controllers/classification_term.rb on lines 87..94
backend/app/controllers/container.rb on lines 78..85
backend/app/controllers/digital_object.rb on lines 53..60
backend/app/controllers/digital_object_component.rb on lines 87..94
backend/app/controllers/event.rb on lines 69..76
backend/app/controllers/job.rb on lines 103..110
backend/app/controllers/rde_templates.rb on lines 39..46

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

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

Identical blocks of code found in 7 locations. Consider refactoring.
Open

        "datafield[@tag='092']" => -> resource, node {
          id = concatenate_subfields(('a'..'z'), node, '_')

          if resource.id_0.nil? or resource.id_0.empty?
            resource.id_0 = id unless id.empty?
Severity: Minor
Found in backend/app/converters/lib/marcxml_bib_base_map.rb and 6 other locations - About 15 mins to fix
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 808..814
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 817..823
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 835..841
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 844..850
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 853..859
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 862..868

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

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

Identical blocks of code found in 7 locations. Consider refactoring.
Open

        "datafield[@tag='090']" => -> resource, node {
          id = concatenate_subfields(('a'..'z'), node, '_')

          if resource.id_0.nil? or resource.id_0.empty?
            resource.id_0 = id unless id.empty?
Severity: Minor
Found in backend/app/converters/lib/marcxml_bib_base_map.rb and 6 other locations - About 15 mins to fix
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 808..814
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 826..832
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 835..841
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 844..850
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 853..859
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 862..868

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

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

  Endpoint.delete('/repositories/:repo_id/accessions/:id')
    .description("Delete an Accession")
    .params(["id", :id],
            ["repo_id", :repo_id])
    .permissions([:delete_archival_record])
Severity: Major
Found in backend/app/controllers/accession.rb and 10 other locations - About 15 mins to fix
backend/app/controllers/assessment.rb on lines 51..58
backend/app/controllers/classification.rb on lines 55..62
backend/app/controllers/classification_term.rb on lines 87..94
backend/app/controllers/container.rb on lines 78..85
backend/app/controllers/digital_object.rb on lines 53..60
backend/app/controllers/digital_object_component.rb on lines 87..94
backend/app/controllers/event.rb on lines 69..76
backend/app/controllers/job.rb on lines 103..110
backend/app/controllers/rde_templates.rb on lines 39..46
backend/app/controllers/resource.rb on lines 101..108

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

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

  Endpoint.delete('/repositories/:repo_id/digital_object_components/:id')
    .description("Delete a Digital Object Component")
    .params(["id", :id],
            ["repo_id", :repo_id])
    .permissions([:delete_archival_record])
Severity: Major
Found in backend/app/controllers/digital_object_component.rb and 10 other locations - About 15 mins to fix
backend/app/controllers/accession.rb on lines 68..75
backend/app/controllers/assessment.rb on lines 51..58
backend/app/controllers/classification.rb on lines 55..62
backend/app/controllers/classification_term.rb on lines 87..94
backend/app/controllers/container.rb on lines 78..85
backend/app/controllers/digital_object.rb on lines 53..60
backend/app/controllers/event.rb on lines 69..76
backend/app/controllers/job.rb on lines 103..110
backend/app/controllers/rde_templates.rb on lines 39..46
backend/app/controllers/resource.rb on lines 101..108

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

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

  Endpoint.delete('/repositories/:repo_id/classification_terms/:id')
    .description("Delete a Classification Term")
    .params(["id", :id],
            ["repo_id", :repo_id])
    .permissions([:delete_classification_record])
Severity: Major
Found in backend/app/controllers/classification_term.rb and 10 other locations - About 15 mins to fix
backend/app/controllers/accession.rb on lines 68..75
backend/app/controllers/assessment.rb on lines 51..58
backend/app/controllers/classification.rb on lines 55..62
backend/app/controllers/container.rb on lines 78..85
backend/app/controllers/digital_object.rb on lines 53..60
backend/app/controllers/digital_object_component.rb on lines 87..94
backend/app/controllers/event.rb on lines 69..76
backend/app/controllers/job.rb on lines 103..110
backend/app/controllers/rde_templates.rb on lines 39..46
backend/app/controllers/resource.rb on lines 101..108

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

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

  Endpoint.delete('/repositories/:repo_id/top_containers/:id')
    .description("Delete a top container")
    .params(["id", :id],
            ["repo_id", :repo_id])
    .permissions([:manage_container_record])
Severity: Major
Found in backend/app/controllers/container.rb and 10 other locations - About 15 mins to fix
backend/app/controllers/accession.rb on lines 68..75
backend/app/controllers/assessment.rb on lines 51..58
backend/app/controllers/classification.rb on lines 55..62
backend/app/controllers/classification_term.rb on lines 87..94
backend/app/controllers/digital_object.rb on lines 53..60
backend/app/controllers/digital_object_component.rb on lines 87..94
backend/app/controllers/event.rb on lines 69..76
backend/app/controllers/job.rb on lines 103..110
backend/app/controllers/rde_templates.rb on lines 39..46
backend/app/controllers/resource.rb on lines 101..108

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

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

Identical blocks of code found in 7 locations. Consider refactoring.
Open

        "datafield[@tag='082']" => -> resource, node {
          id = concatenate_subfields(('a'..'z'), node, '_')

          if resource.id_0.nil? or resource.id_0.empty?
            resource.id_0 = id unless id.empty?
Severity: Minor
Found in backend/app/converters/lib/marcxml_bib_base_map.rb and 6 other locations - About 15 mins to fix
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 808..814
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 817..823
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 826..832
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 835..841
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 844..850
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 853..859

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

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

  Endpoint.delete('/repositories/:repo_id/jobs/:id')
    .description("Delete a Job")
    .params(["id", :id],
            ["repo_id", :repo_id])
    .permissions([:cancel_job])
Severity: Major
Found in backend/app/controllers/job.rb and 10 other locations - About 15 mins to fix
backend/app/controllers/accession.rb on lines 68..75
backend/app/controllers/assessment.rb on lines 51..58
backend/app/controllers/classification.rb on lines 55..62
backend/app/controllers/classification_term.rb on lines 87..94
backend/app/controllers/container.rb on lines 78..85
backend/app/controllers/digital_object.rb on lines 53..60
backend/app/controllers/digital_object_component.rb on lines 87..94
backend/app/controllers/event.rb on lines 69..76
backend/app/controllers/rde_templates.rb on lines 39..46
backend/app/controllers/resource.rb on lines 101..108

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

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

  Endpoint.delete('/repositories/:repo_id/assessments/:id')
    .description("Delete an Assessment")
    .params(["id", :id],
            ["repo_id", :repo_id])
    .permissions([:delete_assessment_record])
Severity: Major
Found in backend/app/controllers/assessment.rb and 10 other locations - About 15 mins to fix
backend/app/controllers/accession.rb on lines 68..75
backend/app/controllers/classification.rb on lines 55..62
backend/app/controllers/classification_term.rb on lines 87..94
backend/app/controllers/container.rb on lines 78..85
backend/app/controllers/digital_object.rb on lines 53..60
backend/app/controllers/digital_object_component.rb on lines 87..94
backend/app/controllers/event.rb on lines 69..76
backend/app/controllers/job.rb on lines 103..110
backend/app/controllers/rde_templates.rb on lines 39..46
backend/app/controllers/resource.rb on lines 101..108

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

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

Identical blocks of code found in 7 locations. Consider refactoring.
Open

        "datafield[@tag='050']" => -> resource, node {
          id = concatenate_subfields(('a'..'z'), node, '_')

          if resource.id_0.nil? or resource.id_0.empty?
            resource.id_0 = id unless id.empty?
Severity: Minor
Found in backend/app/converters/lib/marcxml_bib_base_map.rb and 6 other locations - About 15 mins to fix
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 808..814
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 817..823
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 826..832
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 835..841
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 844..850
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 862..868

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

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

Identical blocks of code found in 7 locations. Consider refactoring.
Open

        "datafield[@tag='096']" => -> resource, node {
          id = concatenate_subfields(('a'..'z'), node, '_')

          if resource.id_0.nil? or resource.id_0.empty?
            resource.id_0 = id unless id.empty?
Severity: Minor
Found in backend/app/converters/lib/marcxml_bib_base_map.rb and 6 other locations - About 15 mins to fix
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 808..814
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 817..823
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 826..832
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 844..850
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 853..859
backend/app/converters/lib/marcxml_bib_base_map.rb on lines 862..868

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

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

  Endpoint.delete('/repositories/:repo_id/digital_objects/:id')
    .description("Delete a Digital Object")
    .params(["id", :id],
            ["repo_id", :repo_id])
    .permissions([:delete_archival_record])
Severity: Major
Found in backend/app/controllers/digital_object.rb and 10 other locations - About 15 mins to fix
backend/app/controllers/accession.rb on lines 68..75
backend/app/controllers/assessment.rb on lines 51..58
backend/app/controllers/classification.rb on lines 55..62
backend/app/controllers/classification_term.rb on lines 87..94
backend/app/controllers/container.rb on lines 78..85
backend/app/controllers/digital_object_component.rb on lines 87..94
backend/app/controllers/event.rb on lines 69..76
backend/app/controllers/job.rb on lines 103..110
backend/app/controllers/rde_templates.rb on lines 39..46
backend/app/controllers/resource.rb on lines 101..108

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

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

  Endpoint.delete('/repositories/:repo_id/rde_templates/:id')
    .description("Delete an RDE Template")
    .params(["id", :id],
            ["repo_id", :repo_id])
    .permissions([:manage_rde_templates])
Severity: Major
Found in backend/app/controllers/rde_templates.rb and 10 other locations - About 15 mins to fix
backend/app/controllers/accession.rb on lines 68..75
backend/app/controllers/assessment.rb on lines 51..58
backend/app/controllers/classification.rb on lines 55..62
backend/app/controllers/classification_term.rb on lines 87..94
backend/app/controllers/container.rb on lines 78..85
backend/app/controllers/digital_object.rb on lines 53..60
backend/app/controllers/digital_object_component.rb on lines 87..94
backend/app/controllers/event.rb on lines 69..76
backend/app/controllers/job.rb on lines 103..110
backend/app/controllers/resource.rb on lines 101..108

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

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

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

  def prefix_id(id)
    if id.nil? or id.empty? or id == 'null'
      ""
    elsif id =~ /^#{@id_prefix}/
      id
Severity: Minor
Found in backend/app/exporters/serializers/ead3.rb and 1 other location - About 15 mins to fix
backend/app/exporters/serializers/ead.rb on lines 24..31

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

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

          if session[:top_container_previous_search]['accession']
            @top_container_previous_search['accession'] = session[:top_container_previous_search]['accession']
            @top_container_previous_search['accession']['id'] = @top_container_previous_search['accession']['uri']
Severity: Minor
Found in frontend/app/controllers/top_containers_controller.rb and 3 other locations - About 15 mins to fix
frontend/app/controllers/top_containers_controller.rb on lines 20..22
frontend/app/controllers/top_containers_controller.rb on lines 30..32
frontend/app/controllers/top_containers_controller.rb on lines 35..37

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

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

          if session[:top_container_previous_search]['location']
            @top_container_previous_search['location'] = session[:top_container_previous_search]['location']
            @top_container_previous_search['location']['id'] = @top_container_previous_search['location']['uri']
Severity: Minor
Found in frontend/app/controllers/top_containers_controller.rb and 3 other locations - About 15 mins to fix
frontend/app/controllers/top_containers_controller.rb on lines 20..22
frontend/app/controllers/top_containers_controller.rb on lines 25..27
frontend/app/controllers/top_containers_controller.rb on lines 30..32

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

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

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

      rescue Exception => e
        Log.error("UNEXPECTED ao save error: #{e.message}\n#{e.backtrace}")
        Log.error(ASUtils.jsonmodels_to_hashes(ao).pretty_inspect) if ao
        raise e
      end
Severity: Minor
Found in backend/app/lib/bulk_import/bulk_import_mixins.rb and 1 other location - About 15 mins to fix
backend/app/lib/bulk_import/top_container_linker.rb on lines 46..50

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

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

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

  def prefix_id(id)
    if id.nil? or id.empty? or id == 'null'
      ""
    elsif id =~ /^#{@id_prefix}/
      id
Severity: Minor
Found in backend/app/exporters/serializers/ead.rb and 1 other location - About 15 mins to fix
backend/app/exporters/serializers/ead3.rb on lines 144..151

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

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

    [ "processing_hours_per_foot_estimate", "processing_total_extent", "processing_hours_total" ].each do |k|
      if !hash[k].nil? and hash[k] !~ /^\-?\d{0,9}(\.\d{1,5})?$/
        errors << [k, "must be a number with no more than nine digits and five decimal places"]
      end
Severity: Minor
Found in common/validations.rb and 3 other locations - About 15 mins to fix
common/validations.rb on lines 569..572
common/validations.rb on lines 575..578
common/validations.rb on lines 745..748

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

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

Severity
Category
Status
Source
Language