scotdalton/institutions

View on GitHub

Showing 5 of 5 total issues

Method institutions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def self.institutions
    unless @institutions
      raise NameError.new("No load path was specified.") if loadpaths.nil?
      raise NameError.new("No files named #{filenames} exist to load in the configured load paths, #{loadpaths}. ") if filenames.empty?
      @institutions = {}
Severity: Minor
Found in lib/institutions.rb - About 2 hrs 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 merge has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def merge(arg={})
      arg.to_hash.each do |key, value|
        next unless valid_instance_variable? key
        instance_variable = instance_variablize(key)
        if instance_variable_defined? instance_variable
Severity: Minor
Found in lib/institutions/institution/merge.rb - About 2 hrs 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 loadfiles has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def self.loadfiles
    loadfiles = []
    if loadfiles.empty?
      loadpaths.each do |loadpath|
        filenames.each do |filename|
Severity: Minor
Found in lib/institutions.rb - About 1 hr 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 deep_merge has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def deep_merge(arg1, arg2, key=nil)
      # Attempt deep merge if the two arguments are
      # instances of the same class.
      if arg1.class == arg2.class
        # Preserve arg1's :code and :name.
Severity: Minor
Found in lib/institutions/institution/merge.rb - About 45 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

Avoid too many return statements within this method.
Open

      return arg2
Severity: Major
Found in lib/institutions/institution/merge.rb - About 30 mins to fix
    Severity
    Category
    Status
    Source
    Language