archivesspace/archivesspace

View on GitHub

Showing 1,475 of 2,432 total issues

Method handle_closer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def handle_closer(node)
        @node_shadow = nil
        @empty_node = false

        node_info = node.is_a?(Array) ? node : [node.local_name, node.depth]
Severity: Minor
Found in backend/app/converters/lib/xml_sax.rb - About 25 mins 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 update_record_references has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.update_record_references(record, ref_source)
      if record.is_a?(Array) || record.respond_to?(:to_array)
        record.map {|e| update_record_references(e, ref_source)}
      elsif record.is_a?(Hash) || record.respond_to?(:each)
        fixed = {}
Severity: Minor
Found in backend/app/converters/lib/utils.rb - About 25 mins 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 get_new has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_new(key)
      conf = configuration[key.to_sym] || {}

      type = conf[:record_type] ? conf[:record_type] : key

Severity: Minor
Found in backend/app/converters/lib/csv_converter.rb - About 25 mins 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_time has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_time(s_or_time)
    if s_or_time.nil?
      nil
    elsif s_or_time.is_a?(Time)
      return s_or_time
Severity: Minor
Found in backend/app/lib/oai/aspace_oai_repository.rb - About 25 mins 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 scoped_dataset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.scoped_dataset(model, where_clause)
    dataset = (model.model_scope == :repository) ? model.this_repo : model

    if where_clause.is_a?(Hash) && where_clause.has_key?(:exclude)
      dataset = dataset.exclude(where_clause[:exclude])
Severity: Minor
Found in backend/app/lib/crud_helpers.rb - About 25 mins 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 subject_template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def subject_template(getterms, getsrc, variant_tag = nil)
    {
      :obj => :subject,
      :rel => :subjects,
      :map => {
Severity: Minor
Found in backend/app/converters/lib/marcxml_bib_base_map.rb - About 25 mins 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 dates_of_existence_date_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def dates_of_existence_date_for(node, subfields)
    date = nil
    subfields.each do |sc|
      date_node = node.at_xpath("subfield[@code='#{sc}']")
      date      = date_node.inner_text.strip.gsub(/[^\d]/, '') if date_node
Severity: Minor
Found in backend/app/converters/lib/marcxml_bib_base_map.rb - About 25 mins 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 subject_map has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def subject_map(terms, rel = :subjects)
    {
      :obj => :subject,
      :rel => rel,
      :map => {
Severity: Minor
Found in backend/app/converters/lib/marcxml_auth_agent_base_map.rb - About 25 mins 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 event_template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.event_template(event_type)
    {
      :record_type => Proc.new {|data|
        data['boolean'] ? :date : nil
      },
Severity: Minor
Found in backend/app/converters/digital_object_converter.rb - About 25 mins 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 nested_record_association_graph has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def nested_record_association_graph(model)
    result = {}

    model.nested_records.each do |nested_record|
      association = nested_record[:association]
Severity: Minor
Found in backend/app/lib/nested_record_resolver.rb - About 25 mins 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_date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_date(value)
    return value if value.respond_to?(:strftime)

    Date.parse(value) # This will raise an exception for badly formatted dates

Severity: Minor
Found in backend/app/lib/oai/oai_gem_patches/date_parse_timezone_fix.rb - About 25 mins 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 validate_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_link(relator, role, errs)
    link = {}
    link["role"] = value_check(@agent_role, role, errs)
    errs << I18n.t("bulk_import.error.bad_role", :label => role) if !link["role"]
    if relator && !relator.empty?
Severity: Minor
Found in backend/app/lib/bulk_import/agent_handler.rb - About 25 mins 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 log_row has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def log_row(row)
    unless row.archival_object_id.nil?
      log_obj = I18n.t("bulk_import.log_obj", :what => I18n.t("bulk_import.ao"), :nm => row.archival_object_display, :id => row.archival_object_id, :ref_id => row.ref_id)
      @log_method.call(I18n.t("bulk_import.log_info", :row => row.row, :what => log_obj))
    end
Severity: Minor
Found in backend/app/lib/bulk_import/import_digital_objects.rb - About 25 mins 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 initialize_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize_info
    super
    @ao = nil
    aoid = @opts[:aoid] || nil
    @resource_level = (aoid.nil? || aoid.strip.empty?)
Severity: Minor
Found in backend/app/lib/bulk_import/import_archival_objects.rb - About 25 mins 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 create_instance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_instance(ao)
    dig_instance = nil

    @notes_handler = NotesHandler.new
    @agent_handler = AgentHandler.new(@current_user, @validate_only)
Severity: Minor
Found in backend/app/lib/bulk_import/import_digital_objects.rb - About 25 mins 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_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def to_hash
    hsh = {'record_title' => nil, 'record_type' => nil, 'error_class' => self.class.name, 'errors' => []}
    hsh['record_title'] = @invalid_object[:title] ? @invalid_object[:title] : "unknown or untitled"
    hsh['record_type'] = @invalid_object.jsonmodel_type ? @invalid_object.jsonmodel_type : "unknown type"

Severity: Minor
Found in backend/app/lib/exceptions.rb - About 25 mins 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 renew has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def renew
    @list = []
    list_hash = {}
    enums = handle_raw_listing(Enumeration, { :name => @which }, @current_user)
    enums[0]["values"].each do |v|
Severity: Minor
Found in backend/app/lib/bulk_import/cv_list.rb - About 25 mins 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 ao_save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def ao_save(ao)
    revived = nil
    begin
      archObj = nil
      if ao.id.nil?
Severity: Minor
Found in backend/app/lib/bulk_import/top_container_linker.rb - About 25 mins 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 resolve_references has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def resolve_references(records, properties_to_resolve, ignored = nil)
    if ignored
      msg = ('Three-argment call to resolve_references is deprecated.' +
             'The "env" parameter is no longer needed.')

Severity: Minor
Found in backend/app/lib/uri_resolver.rb - About 25 mins 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 create_top_container_instances has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_top_container_instances
    instances = []
    cntr = 1
    substr = ""
    until @row_hash["cont_instance_type#{substr}"].nil? && @row_hash["type_1#{substr}"].nil? && @row_hash["barcode#{substr}"].nil?
Severity: Minor
Found in backend/app/lib/bulk_import/import_archival_objects.rb - About 25 mins 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