archivesspace/archivesspace

View on GitHub

Showing 1,475 of 2,432 total issues

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

  def metadata
    md = {
      '@context' => "http://schema.org/",
      '@type' => 'Organization',
      '@id' => AppConfig[:public_proxy_url] + uri,
Severity: Minor
Found in public/app/models/agent_corporate_entity.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 fetch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def fetch(resource_uri, page_uri, params, query, sort, type, enums = [])
    qry = "collection_uri_u_sstr:\"#{resource_uri}\" AND (#{query})"
    @base_search = "#{page_uri}?"
    search_opts =  default_search_opts({
      'sort' => sort,
Severity: Minor
Found in public/app/controllers/resources_controller.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 metadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def metadata
    md = {
      '@context' => "http://schema.org/",
      '@type' => 'Organization',
      '@id' => AppConfig[:public_proxy_url] + uri,
Severity: Minor
Found in public/app/models/agent_family.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 show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    uri = "/repositories/#{params[:id]}"
    resources = {}
    query = "(id:\"#{uri}\" AND publish:true)"
    @counts = get_counts("/repositories/#{params[:id]}")
Severity: Minor
Found in public/app/controllers/repositories_controller.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 flatten_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def flatten_keys(hash, prefix = '')
      keys = []
      hash.keys.each do |key|
        if hash[key].is_a? Hash
          current_prefix = prefix + "#{key}."
Severity: Minor
Found in scripts/tasks/check.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 handle_rights has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_rights(rights_statements)
    rights_statements.each do |rs|

      case rs['rights_type']

Severity: Minor
Found in backend/app/exporters/models/dc.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 boolean_narrow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def boolean_narrow(template, field_name)
    return unless @possible_fields.include? field_name
    value = template['fields'][field_name]['value']
    @conditions.push("#{field_name} = #{db.literal(value == 'true' ? true : false)}")
    info[field_name] = value.to_s == 'true' ? 'Yes' : 'No'
Severity: Minor
Found in reports/custom/custom_report.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 backup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def backup(output_file, do_mysqldump = false)
    output_file = File.absolute_path(output_file, ENV['ORIG_PWD'])

    if File.exist?(output_file)
      puts "Output file '#{output_file}' already exists!  Aborting"
Severity: Minor
Found in launcher/backup/lib/backup.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 request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def request(url, req, format = :json)
    req['X-ArchivesSpace-Session'] = @token
    ASHTTP.start_uri(url) do |http|
      response = http.request(req)
      if response.code =~ /^4/
Severity: Minor
Found in launcher/request_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 family_name_subtags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def family_name_subtags(name, xml, related = false)
    related_sfs(name, xml) if related

    name_parts = [
      { code: 'c', value: name['location'] },
Severity: Minor
Found in backend/app/exporters/serializers/marc_auth.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 each_description has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def each_description
    if @json.respond_to?('notes')
      @json.notes.each do |note|
        if self.class.DESCRIPTIVE_NOTE_TYPES.include? note['type']
          yield extract_note_content(note)
Severity: Minor
Found in backend/app/exporters/models/dc.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 special_translation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def special_translation(key, subreport_code)
        if subreport_code == 'extent_subreport'
            I18n.t("extent.#{key}", :default => nil)
        elsif subreport_code == 'date_subreport'
            I18n.t("date.#{key}", :default => nil)
Severity: Minor
Found in reports/resources/resources_list_report/resources_list_report.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(parent_custom_report, id)
        super(parent_custom_report)

        id_type = parent_custom_report.record_type
        record_type = if id_type.include?('agent')
Severity: Minor
Found in reports/custom/linked_accession_subreport.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 handle_notes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_notes(notes)
    notes.each do |note|
      # physdesc and dimensions are treated separately from other notes
      next if note['type'] == 'physdesc' || note['type'] == 'dimensions'
      content = ASpaceExport::Utils.extract_note_text(note)
Severity: Minor
Found in backend/app/exporters/models/mods.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 _build_date_range_std has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def _build_date_range_std(date, xml)
    begin_expression = date['structured_date_range']['begin_date_expression']
    begin_standardized = date['structured_date_range']['begin_date_standardized']

    end_expression = date['structured_date_range']['end_date_expression']
Severity: Minor
Found in backend/app/exporters/serializers/eac.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 bind has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def bind
    conn = Net::LDAP.new.tap do |conn|
      conn.host = @hostname
      conn.port = @port

Severity: Minor
Found in backend/app/model/ldapauth.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 handle_linebreaks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_linebreaks(content)
    # 4archon...
    content.gsub!("\n\t", "\n\n")
    # if there's already p tags, just leave as is
    return content if ( content.strip =~ /^<p(\s|\/|>)/ or content.strip.length < 1 )
Severity: Minor
Found in backend/app/exporters/serializers/ead.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 transfer_to_repository has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def transfer_to_repository(target_repository, transfer_group = [])
      if self.class.columns.include?(:repo_id)

        source_repository = Repository[self.repo_id]

Severity: Minor
Found in backend/app/model/ASModel_transfers.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 sequel_to_jsonmodel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.sequel_to_jsonmodel(objs, opts = {})
    jsons = super

    jsons.zip(objs).each do |json, obj|
      parent_uri = if obj.resource_id
Severity: Minor
Found in backend/app/model/collection_management.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 serialize_controlaccess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def serialize_controlaccess(data, xml, fragments)
    if (data.controlaccess_subjects.length + data.controlaccess_linked_agents(@include_unpublished).reject {|x| x.empty?}.length) > 0
      xml.controlaccess {
        data.controlaccess_subjects.zip(data.subjects).each do |node_data, subject|
          xml.send(node_data[:node_name], node_data[:atts]) {
Severity: Minor
Found in backend/app/exporters/serializers/ead.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