archivesspace/archivesspace

View on GitHub

Showing 1,505 of 2,469 total issues

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

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 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 substitute_parameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.substitute_parameters(uri, opts = {})
    matched = []
    opts.each do |k, v|
      old = uri
      uri = uri.gsub(":#{k}", URI.escape(v.to_s))
Severity: Minor
Found in common/jsonmodel_type.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 set_repo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def set_repo(repo)
    if repo.respond_to?(:uri)
      set_repo(repo.uri)
    elsif repo.is_a?(String) && repo.match(/^\/repositories\/\d+/)
      set_repo(JSONModel(:repository).id_for(repo))
Severity: Minor
Found in common/selenium/backend_client_mixin.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 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 setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.setup
    ENV['TMPDIR'] = java.lang.System.get_property("java.io.tmpdir")
    ENV['TEMPDIR'] = java.lang.System.get_property("java.io.tmpdir")

    if java.lang.System.get_property("aspace.launcher.base")
Severity: Minor
Found in common/aspace_gems.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 with_validator_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.with_validator_for(jsonmodel, data)
    Thread.current[:validator_cache] ||= {}

    created = false
    if Thread.current[:validator_cache][jsonmodel]
Severity: Minor
Found in common/validator_cache.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_schema_messages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.parse_schema_messages(messages, validator)
    messages = self.extract_suberrors(messages)

    msgs = {
      :errors => {},
Severity: Minor
Found in common/json_schema_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 calculate_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def calculate_hash(db, table, row)
  foreign_key = :"#{table}_id"
  hash_fields = []

  db[:date].filter(foreign_key => row[:id]).each do |date|
Severity: Minor
Found in common/db/migrations/025_add_agent_hash.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 check_structured_date_single has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.check_structured_date_single(hash)
    errors = []

    if hash["date_role"].nil?
      errors << ["date_role", "is required"]
Severity: Minor
Found in common/validations.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 add_column has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_column(label, opts = {}, block = nil)
    block ||= if opts[:template]
                proc do |record|
                  render_aspace_partial :partial => opts[:template], :locals => {:record => record}
                end
Severity: Minor
Found in frontend/app/helpers/search_helper.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 all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def all(params = {}, opts = {})
        uri = my_url(nil, opts)

        uri.query = URI.encode_www_form(params)

Severity: Minor
Found in common/jsonmodel_client.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