archivesspace/archivesspace

View on GitHub

Showing 1,469 of 2,413 total issues

Method parse has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

  def parse cmdline=ARGV
    vals = {}
    required = {}

    opt :version, "Print version and exit" if @version unless @specs[:version] || @long["version"]
Severity: Minor
Found in launcher/backup/lib/trollop.rb - About 1 day 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 configure has 255 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.configure
    {
      # 1. Map the cell data to schemas or handlers

      'agent_role' => 'd.agent_role',
Severity: Major
Found in backend/app/converters/digital_object_converter.rb - About 1 day to fix

    Method configure has 251 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.configure
        {
          # 1. Map the cell data to schemas / handlers
          # {column header} => {data address}
          # or,
    Severity: Major
    Found in backend/app/converters/accession_converter.rb - About 1 day to fix

      Function 7 has 247 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function (require, module, exports) {
                (function (global, factory) {
                  if (typeof define === 'function' && define.amd) {
                    define(['module', 'select'], factory);
                  } else if (typeof exports !== 'undefined') {
      Severity: Major
      Found in frontend/app/assets/javascripts/clipboard.js - About 1 day to fix

        File 088_rights_management.rb has 577 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'securerandom'
        require 'json'
        
        
        def backup_rights_statement_table
        Severity: Major
        Found in common/db/migrations/088_rights_management.rb - About 1 day to fix

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

          AbstractRelationship = Class.new(Sequel::Model) do
          
            include ObjectGraph
          
            # Create a relationship instance between two objects with a defined set of properties.
          Severity: Major
          Found in backend/app/model/mixins/relationships.rb - About 1 day to fix

            Method _cpfdesc has 230 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def _cpfdesc(json, xml, obj)
                xml.cpfDescription do
                  xml.identity do
                    # AGENT_IDENTIFIERS
                    with(xml, json['agent_identifiers']) do |ad|
            Severity: Major
            Found in backend/app/exporters/serializers/eac.rb - About 1 day to fix

              File application_controller.rb has 548 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'asconstants'
              require 'memoryleak'
              require 'search'
              require 'zlib'
              
              
              Severity: Major
              Found in frontend/app/controllers/application_controller.rb - About 1 day to fix

                Function 8 has 228 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function (require, module, exports) {
                          (function (global, factory) {
                            if (typeof define === 'function' && define.amd) {
                              define([
                                'module',
                Severity: Major
                Found in frontend/app/assets/javascripts/clipboard.js - About 1 day to fix

                  Method serialize_dates has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def serialize_dates(obj, xml, fragments)
                      add_unitdate = Proc.new do |value, context, fragments, atts={}|
                        context.unitdate(atts) {
                          sanitize_mixed_content( value, context, fragments )
                        }
                  Severity: Minor
                  Found in backend/app/exporters/serializers/ead3.rb - About 1 day 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

                  File linker.js has 542 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  //= require jquery.tokeninput
                  
                  $(function () {
                    let resource_edit_path_regex = new RegExp(
                      '^' + APP_PATH + 'resources/\\d+/edit$'
                  Severity: Major
                  Found in frontend/app/assets/javascripts/linker.js - About 1 day to fix

                    Method convert_ead2002_markup has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def convert_ead2002_markup(content)
                        apply_changes = lambda do |fn, fragment|
                          fragment.element_children.each do |e|
                            fn.(e)
                            if !e.element_children.empty?
                    Severity: Minor
                    Found in backend/app/exporters/serializers/ead3.rb - About 1 day 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 serialize_control has 222 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def serialize_control(data, xml, fragments)
                        control_atts = {
                          repositoryencoding: "iso15511",
                          countryencoding: "iso3166-1",
                          dateencoding: "iso8601",
                    Severity: Major
                    Found in backend/app/exporters/serializers/ead3.rb - About 1 day to fix

                      File mixed_content.config.js has 528 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      $(function () {
                        AS.mixedContentElements = {
                          language: {
                            tag: 'language',
                            attributes: [],
                      Severity: Major
                      Found in frontend/app/assets/javascripts/mixed_content.config.js - About 1 day to fix

                        Class FormContext has 60 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                          class FormContext
                        
                            def initialize(name, values_from, parent)
                              values = values_from.is_a?(JSONModelType) ? values_from.to_hash(:raw) : values_from
                        
                        
                        Severity: Major
                        Found in frontend/app/helpers/aspace_form_helper.rb - About 1 day to fix

                          Method process_file_versions has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def process_file_versions(json)
                              dig_f = {}
                              unless json['file_versions'].blank?
                                embed_caption = ''
                                rep_caption = ''
                          Severity: Minor
                          Found in public/app/controllers/concerns/result_info.rb - About 1 day 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 returns has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def returns(*returns, &block)
                                raise "No .permissions declaration for endpoint #{@methods.map {|m| m.to_s.upcase}.join('|')} #{@uri}" if !@has_permissions
                          
                                @returns = returns.map { |r| r[1] = @@return_types[r[1]] || r[1]; r }
                          
                          
                          Severity: Minor
                          Found in backend/app/lib/rest.rb - About 1 day 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

                          File archival_objects.crud.js has 515 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          //= require agents.crud
                          //= require subjects.crud
                          //= require dates.crud
                          //= require notes.crud
                          //= require instances.crud
                          Severity: Major
                          Found in frontend/app/assets/javascripts/archival_objects.crud.js - About 1 day to fix

                            Method preview_sort_name has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def preview_sort_name(target)
                                result = ""
                            
                                case target['jsonmodel_type']
                                when 'name_person'
                            Severity: Minor
                            Found in backend/app/lib/merge_helpers.rb - About 1 day 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 serialize_digital_object has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def serialize_digital_object(digital_object, xml, fragments)
                                return if digital_object["publish"] === false && !@include_unpublished
                                return if digital_object["suppressed"] === true
                            
                                # ANW-285: Only serialize file versions that are published, unless include_unpublished flag is set
                            Severity: Minor
                            Found in backend/app/exporters/serializers/ead.rb - About 7 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

                            Severity
                            Category
                            Status
                            Source
                            Language