ndlib/sipity

View on GitHub

Showing 96 of 96 total issues

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

module Sipity
  module Forms
    module WorkSubmissions
      module Core
        # Responsible for calling the ETD Ingester
app/forms/sipity/forms/work_submissions/core/submit_for_doi_minting_form.rb on lines 2..37
app/forms/sipity/forms/work_submissions/core/submit_for_file_reingest_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

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

module Sipity
  module Forms
    module WorkSubmissions
      module Core
        # Responsible for calling the ETD Ingester
app/forms/sipity/forms/work_submissions/core/submit_for_doi_minting_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

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

        var $roleFieldCell = $newField
                       .children('td.role')
                       .last()
                       .children('div')
                       .children('select')
Severity: Major
Found in app/assets/javascripts/sipity/manage_repeating_sections.js and 2 other locations - About 1 hr to fix
app/assets/javascripts/sipity/manage_repeating_sections.js on lines 70..75
app/assets/javascripts/sipity/manage_repeating_sections.js on lines 85..91

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

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

        var $nameFieldCell = $newField.children('td.name')
                       .first()
                       .children('div')
                       .children('input')
                       .attr('id', 'work_collaborators__attributes_' + rowNumber + '_name')
Severity: Major
Found in app/assets/javascripts/sipity/manage_repeating_sections.js and 2 other locations - About 1 hr to fix
app/assets/javascripts/sipity/manage_repeating_sections.js on lines 77..83
app/assets/javascripts/sipity/manage_repeating_sections.js on lines 85..91

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

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

        var $revieweOptionCell = $newField
                       .children('td.review')
                       .last()
                       .children('div')
                       .children('select')
Severity: Major
Found in app/assets/javascripts/sipity/manage_repeating_sections.js and 2 other locations - About 1 hr to fix
app/assets/javascripts/sipity/manage_repeating_sections.js on lines 70..75
app/assets/javascripts/sipity/manage_repeating_sections.js on lines 77..83

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

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 46 lines of code (exceeds 25 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 1 hr to fix

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

  module Exporters
    class FileReplacementExporter
      # Responsible for loading the specific files that should be written to the batch ingest.
      class AttachmentWriter
        # @api public
app/exporters/sipity/exporters/batch_ingest_exporter/attachment_writer.rb on lines 2..30

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

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 Exporters
    class BatchIngestExporter
      # Responsible for writing the specific files that should be written to the batch ingest.
      class AttachmentWriter
        # @api public
app/exporters/sipity/exporters/file_replacement_exporter/attachment_writer.rb on lines 2..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 72.

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_users_for_entity_and_roles has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def scope_users_for_entity_and_roles(entity:, roles:)
        entity = Conversions::ConvertToProcessingEntity.call(entity)
        role_ids = Array.wrap(roles).map { |role| Conversions::ConvertToRole.call(role).id }
        group_polymorphic_type = PowerConverter.convert(Models::Group, to: :polymorphic_type)
        user_polymorphic_type = PowerConverter.convert(User, to: :polymorphic_type)
Severity: Minor
Found in app/repositories/sipity/queries/processing_queries.rb - About 1 hr to fix

Method call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def call
        create_the_strategy_action!

        if config.key?(:attributes)
          action_attributes = config.fetch(:attributes).stringify_keys

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 call has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def call
        create_the_strategy_action!

        if config.key?(:attributes)
          action_attributes = config.fetch(:attributes).stringify_keys

Method scope_permitted_entity_strategy_actions_for_current_state has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def scope_permitted_entity_strategy_actions_for_current_state(user:, entity:)
        action_scope = scope_permitted_without_concern_for_repetition_entity_strategy_actions_for_current_state(user: user, entity: entity)

        entity = Conversions::ConvertToProcessingEntity.call(entity)
        actor = Conversions::ConvertToProcessingActor.call(user)
Severity: Minor
Found in app/repositories/sipity/queries/processing_queries.rb - About 1 hr to fix

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

      collaboratorControl.last().children('td.name').first().children('div').children('input').first().removeClass('required').removeAttr('required');
Severity: Major
Found in app/assets/javascripts/application.js and 1 other location - About 1 hr to fix
app/assets/javascripts/application.js on lines 45..45

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

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

      collaboratorControl.last().children('td.role').first().children('div').children('select').first().removeClass('required').removeAttr('required');
Severity: Major
Found in app/assets/javascripts/application.js and 1 other location - About 1 hr to fix
app/assets/javascripts/application.js on lines 44..44

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

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_actors_associated_with_entity_and_role has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def scope_actors_associated_with_entity_and_role(entity:, role:)
        entity = Conversions::ConvertToProcessingEntity.call(entity)
        role = Conversions::ConvertToRole.call(role)
        strategy_roles = Models::Processing::StrategyRole.arel_table
        strategy_responsibilities = Models::Processing::StrategyResponsibility.arel_table
Severity: Minor
Found in app/repositories/sipity/queries/processing_queries.rb - About 1 hr to fix

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

  module ProcessingHooks
    module Etd
      module Works
        # Responsible for performing any additional behavior as part of a user
        # taking the SubmitForReview action on an ETD Work.
app/processing_hooks/sipity/processing_hooks/etd/works/submit_for_review_processing_hook.rb on lines 2..35

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

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 ProcessingHooks
    module Etd
      module Works
        # Responsible for performing any additional behavior as part of a user
        # taking the SubmitForReview action on an ETD Work.
app/processing_hooks/sipity/processing_hooks/etd/works/grad_school_signoff_processing_hook.rb on lines 4..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 55.

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 build has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.build(mailer_suffix, &block)
      builder = new
      builder.instance_exec(&block) if block_given?
      the_mailer_name = File.join('sipity/mailers', "#{mailer_suffix.to_s.underscore}_mailer")

Severity: Minor
Found in app/mailers/sipity/mailer_builder.rb - About 1 hr to fix

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

    _destroy: function() {
      this.actions.remove();
      $('.repeat', this.element).removeClass("input-append");
      this.element.removeClass( "managed" );
    }
Severity: Major
Found in app/assets/javascripts/sipity/manage_repeating_sections.js and 1 other location - About 1 hr to fix
app/assets/javascripts/sipity/manage_repeating_fields.js on lines 76..80

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

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

    _destroy: function() {
      this.actions.remove();
      $('.field-wrapper', this.element).removeClass("input-append");
      this.element.removeClass( "managed" );
    }
Severity: Major
Found in app/assets/javascripts/sipity/manage_repeating_fields.js and 1 other location - About 1 hr to fix
app/assets/javascripts/sipity/manage_repeating_sections.js on lines 152..156

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

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