emory-libraries/dlp-selfdeposit

View on GitHub

Showing 8 of 13 total issues

File works_controller_behavior.rb has 389 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'iiif_manifest'

module Hyrax
  module WorksControllerBehavior
    extend ActiveSupport::Concern
Severity: Minor
Found in app/controllers/concerns/hyrax/works_controller_behavior.rb - About 5 hrs to fix

    File accordion.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // TO DO: Remove console.log statements
    
    // wait for page to load (ruby seems to act weird if we don't)
    document.addEventListener('DOMContentLoaded', function (event) {
        // get accordion elements
    Severity: Minor
    Found in app/assets/javascripts/accordion.js - About 4 hrs to fix

      Function formSetup has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function formSetup() {
          //fields
          var parTitle = document.getElementsByClassName("form-group string optional publication_parent_title");
          var confName = document.getElementsByClassName("form-group string optional publication_conference_name");
          var isbn = document.getElementsByClassName("form-group string optional publication_isbn");
      Severity: Major
      Found in app/assets/javascripts/accordion.js - About 3 hrs to fix

        Function validateForm has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function validateForm() {
        
        
        
        
        
        Severity: Major
        Found in app/assets/javascripts/accordion.js - About 2 hrs to fix

          Function validateForm has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          function validateForm() {
          
          
          
          
          
          Severity: Minor
          Found in app/assets/javascripts/accordion.js - 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 to_solr has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                def to_solr
                  super.tap do |solr_doc|
                    solr_doc['alternate_ids_ssim'] = find_alternate_ids
                    solr_doc['preservation_events_tesim'] = resource&.preservation_events&.map(&:preservation_event_terms)
          
          
          Severity: Minor
          Found in app/indexers/self_deposit/indexers/file_set_indexer.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

          Avoid too many return statements within this function.
          Open

                          return false;
          Severity: Major
          Found in app/assets/javascripts/accordion.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return true;
            Severity: Major
            Found in app/assets/javascripts/accordion.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language