archivesspace/archivesspace

View on GitHub

Showing 2,413 of 2,413 total issues

File eac.rb has 648 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class EACSerializer < ASpaceExport::Serializer
  serializer_for :eac

  def serialize(eac, _opts = {})
    builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
Severity: Major
Found in backend/app/exporters/serializers/eac.rb - About 1 day to fix

    File validations.rb has 624 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'date'
    require 'time'
    require 'barcode_check'
    
    module JSONModel::Validations
    Severity: Major
    Found in common/validations.rb - About 1 day to fix

      File marc_auth.rb has 618 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class MARCAuthSerializer < ASpaceExport::Serializer
        serializer_for :marc_auth
      
        def serialize(marc, _opts = {})
          builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
      Severity: Major
      Found in backend/app/exporters/serializers/marc_auth.rb - About 1 day to fix

        Method _control has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
        Open

          def _control(json, xml)
            xml.control do
              # AGENT_RECORD_IDENTIFIERS
              with(xml, json['agent_record_identifiers']) do |ari|
                if ari['primary_identifier'] == true
        Severity: Minor
        Found in backend/app/exporters/serializers/eac.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 sequel_to_jsonmodel has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
        Open

            def sequel_to_jsonmodel(objs, opts = {})
              jsons = super
        
              jsons.each do |json|
                case self.name
        Severity: Minor
        Found in backend/app/model/mixins/representative_file_version.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 merge_record has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
        Open

          def merge_record(json_in, opts)
            json = json_in.clone
        
            direct_only = opts.fetch(:direct_only) { false }
            remove_ancestors = opts.fetch(:remove_ancestors) { false }
        Severity: Minor
        Found in common/record_inheritance.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 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
                              Severity
                              Category
                              Status
                              Source
                              Language