ndlib/sipity

View on GitHub

Showing 96 of 96 total issues

File processing_queries.rb has 569 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'active_support/core_ext/array/wrap'

module Sipity
  module Queries
    # Welcome intrepid developer. You have stumbled into some complex data
Severity: Major
Found in app/repositories/sipity/queries/processing_queries.rb - About 1 day to fix

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

module Sipity
  module Forms
    module WorkSubmissions
      module Ulra
        # Responsible for submitting the associated entity to the advisor
app/forms/sipity/forms/work_submissions/ulra/submit_student_portion_form.rb on lines 4..67

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

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

module Sipity
  module Forms
    module WorkSubmissions
      module Ulra
        # Responsible for submitting the associated entity to the advisor
app/forms/sipity/forms/work_submissions/ulra/submit_advisor_portion_form.rb on lines 4..67

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

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

module Sipity
  module Forms
    module WorkSubmissions
      module Etd
        # Responsible for submitting the final Grad School approval.
app/forms/sipity/forms/work_submissions/etd/send_to_cataloging_form.rb on lines 5..59

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

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

module Sipity
  module Forms
    module WorkSubmissions
      module Etd
        # Responsible for submitting the final Grad School approval and mark it for cataloging.
app/forms/sipity/forms/work_submissions/etd/grad_school_signoff_form.rb on lines 5..59

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

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

module Sipity
  module Forms
    module WorkSubmissions
      module Etd
        # Responsible for capturing a student's comment and forwarding them on to
app/forms/sipity/forms/work_submissions/etd/respond_to_grad_school_request_form.rb on lines 5..56

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

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

module Sipity
  module Forms
    module WorkSubmissions
      module Etd
        # Responsible for capturing comments from cataloger and forwarding them to the grad school.
app/forms/sipity/forms/work_submissions/etd/grad_school_requests_change_form.rb on lines 5..56

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

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

module Sipity
  module Forms
    module WorkSubmissions
      module Etd
        # Responsible for capturing comments and forwarding them on to the
app/forms/sipity/forms/work_submissions/etd/send_back_to_grad_school_form.rb on lines 3..53

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

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

module Sipity
  module Forms
    module WorkSubmissions
      module Etd
        # Responsible for capturing a student's comment and forwarding them on to
app/forms/sipity/forms/work_submissions/etd/respond_to_advisor_request_form.rb on lines 5..56

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

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

Method scope_processing_entities_for_the_user_and_proxy_for_type has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def scope_processing_entities_for_the_user_and_proxy_for_type(criteria:)
        proxy_for_type = PowerConverter.convert(criteria.proxy_for_type, to: :polymorphic_type)

        entities = Models::Processing::Entity.arel_table
        strategy_state_actions = Models::Processing::StrategyStateAction.arel_table
Severity: Major
Found in app/repositories/sipity/queries/processing_queries.rb - About 3 hrs to fix

Class WorkEmailDecorator has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

      class WorkEmailDecorator
        def initialize(work, repository: default_repository)
          self.work = work
          self.repository = repository
        end
Severity: Minor
Found in app/decorators/sipity/decorators/emails/work_email_decorator.rb - About 3 hrs to fix

Function add_to_section_list has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    add_to_section_list: function( event ) {
      event.preventDefault();

      var $activeField = $('.repeat:last', this.element), // Assume we are always working with the bottom-most row
          $activeFieldControls = $activeField.children('.row-controls'),
Severity: Major
Found in app/assets/javascripts/sipity/manage_repeating_sections.js - About 2 hrs to fix

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

        var $idFieldCell = $newField
                       .children('td.contact-information')
                       .first()
                       .children('span')
                       .first()
Severity: Major
Found in app/assets/javascripts/sipity/manage_repeating_sections.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/sipity/manage_repeating_sections.js on lines 103..111

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

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

        var $emailFieldCell = $newField
                       .children('td.contact-information')
                       .first()
                       .children('span')
                       .last()
Severity: Major
Found in app/assets/javascripts/sipity/manage_repeating_sections.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/sipity/manage_repeating_sections.js on lines 93..101

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

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

Method configure has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def self.configure(form_class:, base_class:, attribute_names:, **keywords)
        processing_form_class = self
        form_class.module_exec do
          class_attribute(:attribute_names, instance_writer: :false) unless respond_to?(:attribute_names=)
          self.attribute_names = Array.wrap(attribute_names)
Severity: Minor
Found in app/forms/sipity/forms/processing_form.rb - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Class AttachmentsExtension has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

      class AttachmentsExtension
        def initialize(form:, repository:, **args)
          self.form = form
          self.repository = repository
          self.files = args[:files] || {}
Severity: Minor
Found in app/forms/sipity/forms/composable_elements/attachments_extension.rb - About 2 hrs to fix

Class CoreConverter has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

        class CoreConverter
          DEFAULT_ROF_TYPE = 'fobject'.freeze
          def initialize(work:, repository: default_repository, attachment_converter: default_attachment_converter)
            self.work = work
            self.repository = repository

Class ActionTakenOnEntity has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

    class ActionTakenOnEntity
      def self.register(**keywords)
        new(**keywords).register
      end

Severity: Minor
Found in app/services/sipity/services/action_taken_on_entity.rb - About 2 hrs to fix

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

      def convert_to_year(input)
        return input if input.is_a?(Integer)
        return input.to_year if input.respond_to?(:to_year)
        return input.year if input.respond_to?(:year)
        return convert_to_year(input.to_date) if input.respond_to?(:to_date)
Severity: Minor
Found in app/conversions/sipity/conversions/convert_to_year.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

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

module Sipity
  module Forms
    module WorkSubmissions
      module Core
        # Responsible for calling the DOI Minter
app/forms/sipity/forms/work_submissions/core/submit_for_file_reingest_form.rb on lines 2..37
app/forms/sipity/forms/work_submissions/core/submit_for_ingest_form.rb on lines 2..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 74.

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