archivesspace/archivesspace

View on GitHub

Showing 1,475 of 2,432 total issues

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

  def _date_map(dates)
    return [] unless dates

    dates.map do |date|
      date_method = _date_processor(date)
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 generate_token has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.generate_token(username)
    authentication_sources.each do |source|
      next unless source == DBAuth
      if (token = source.generate_token(username))
        return token
Severity: Minor
Found in backend/app/model/authentication_manager.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_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def serialize_name(name, xml)
    atts = {:type => name['type']}
    atts[:authority] = name['source'] if name['source']
    atts["valueURI"] = name['authority_id'] if name['authority_id']
    xml.name(atts) {
Severity: Minor
Found in backend/app/exporters/serializers/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 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|

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

  def assimilate(other_repository)
    ASModel.all_models.each do |model|
      if model.model_scope(true) == :repository
        model.transfer_all(other_repository, self) unless [ Preference ].include?(model)
      end
Severity: Minor
Found in backend/app/model/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 publish! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def publish!(setting = true)
      object_graph = self.object_graph

      object_graph.each do |model, ids|
        next unless model.publishable?
Severity: Minor
Found in backend/app/model/ASModel_scoping.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 sanitize_mixed_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def sanitize_mixed_content(content, context, fragments, allow_p = false )
    # remove smart quotes from text
    content = remove_smart_quotes(content)

    # br's should be self closing
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 serialize_languages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def serialize_languages(languages, xml, fragments)
    language_vals = languages.map {|l| l['language_and_script']}.compact
    # Language and Script subrecords with recorded values in both fields should be exported as <languageset> elements.
    xml.langmaterial {
      language_vals.map {|language|
Severity: Minor
Found in backend/app/exporters/serializers/ead3.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(params, job, db)
    @repo_id = params[:repo_id] if params.has_key?(:repo_id) && params[:repo_id] != ''
    @format = params[:format] if params.has_key?(:format) && params[:format] != ''
    @expand_csv = !(params.has_key?('csv_show_json') ? params['csv_show_json'] : false)
    @params = params
Severity: Minor
Found in backend/app/model/reports/abstract_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 authenticate_token has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.authenticate_token(username, token)
    authentication_sources.each do |source|
      next unless source == DBAuth
      if (user = source.authenticate_token(username, token))
        return user
Severity: Minor
Found in backend/app/model/authentication_manager.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 define_relationship has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def define_relationship(opts)
      [:name, :contains_references_to_types].each do |p|
        opts[p] or raise "No #{p} given"
      end

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

  def validate
    is_published = false
    if self[:publish] == true || self[:publish] == 1
      is_published = true
    end
Severity: Minor
Found in backend/app/model/file_version.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 after_initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def after_initialize
    # Split the identifier into its components and add the individual pieces as
    # variables on this instance.
    if self[:identifier]
      identifier = Identifiers.parse(self[:identifier])
Severity: Minor
Found in backend/app/model/mixins/identifiers.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_up_date_record_handling has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.set_up_date_record_handling(relationship_clz)
    relationship_clz.instance_eval do
      extend JSONModel
      one_to_one :relationship_date, :class => "StructuredDateLabel", :key => :related_agents_rlshp_id

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

  def update_associated_name_forms
    sdl = StructuredDateLabel.first(:id => self.structured_date_label_id)

    # See if label object is attached directly to an agent, which indicates a date of existence
    if sdl.agent_person_id
Severity: Minor
Found in backend/app/model/mixins/agent_name_dates.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_container_profile_mapping has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def build_container_profile_mapping
      DB.open do |db|
        housed_at_rlshp = TopContainer.find_relationship(:top_container_housed_at)
        profile_rlshp = TopContainer.find_relationship(:top_container_profile)

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

  def for_top_containers(top_containers)
    top_containers_by_id = Hash[top_containers.map {|top_container| [top_container.id, top_container]}]
    result = Hash[top_containers.map {|top_container| [top_container, false]}]

    Instance.enclosing_associations.each do |association|
Severity: Minor
Found in backend/app/model/implied_publication_calculator.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_container has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def add_container(name, dimensions, max_tower_count)
      container = Container.new(name, dimensions, (max_tower_count || :unlimited))

      pile = find_pile_for(container)

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

  def uri_for_other_referent_than(obj)
    self.class.participating_models.each {|model|
      self.class.reference_columns_for(model).each {|column|
        if self[column] && (model != obj.class || self[column] != obj.id)
          return model.my_jsonmodel.uri_for(self[column],
Severity: Minor
Found in backend/app/model/mixins/relationships.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(width, height, depth, unit = nil)
      @provided_unit = (unit ? unit.intern : :inches)
      unless UNIT_CONVERSIONS.has_key?(@provided_unit)
        raise UnsupportedUnitException.new("Provided unit not supported: #{@provided_unit}")
      end
Severity: Minor
Found in backend/app/model/space_calculator.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