LafayetteCollegeLibraries/spot

View on GitHub

Showing 25 of 25 total issues

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

  def write_entries(entries, path, zipfile)
    entries.each do |entry|
      zipfile_path = path == '' ? entry : File.join(path, entry)
      disk_file_path = File.join(src_path, zipfile_path)

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

    def map_rdf_strings(tuples)
      tuples.map do |(value, language)|
        # need to skip blank entries here, otherwise we get a blank literal
        # (""@"") which LDP doesn't like
        next if value.blank?
Severity: Minor
Found in app/forms/concerns/language_tagged_form_fields.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 gather_collections_to_add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def gather_collections_to_add
      collections_to_check = [self]

      [].tap do |collections|
        until collections_to_check.size.zero?
Severity: Minor
Found in app/models/concerns/spot/nested_collection_behavior.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add(env, id)
        collection = ::Collection.find(id)

        return unless env.current_ability.can?(:deposit, collection)

Severity: Minor
Found in app/actors/spot/actors/collections_membership_actor.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_field_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def build_field_options(value, _index)
    return super if defined?(super)

    dom_id = input_dom_id if respond_to?(:input_dom_id)
    dom_id ||= "#{object_name}_#{attribute_name}"
Severity: Minor
Found in app/inputs/concerns/language_tagging.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