app/shared/json_convertible.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method to_object_dictionary has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def to_object_dictionary(ignore_instance_variables: [])
        object_hash = {}
        instance_variables.each do |var|
          next if ignore_instance_variables.include?(var)
          # If we encounter with a `var` which value is an `Array`, we should iterate
Severity: Minor
Found in app/shared/json_convertible.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 from_json! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def from_json!(json_object)
        instance, json_object = _initialize_using!(json_object)
        json_object.each do |var, val|
          # If we encounter with a value that is represented by an array, iterate over it.
          if val.kind_of?(Array)
Severity: Minor
Found in app/shared/json_convertible.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 _from_json! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def _from_json!(var, val, is_iterable: false)
        # TODO: attribute_key_name_map doesn't seem to be used anywhere in the code base
        if attribute_key_name_map.key(var)
          var_name = attribute_key_name_map.key(var).to_sym
        else
Severity: Minor
Found in app/shared/json_convertible.rb - About 55 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

There are no issues that match your filters.

Category
Status