sgammon/GUST

View on GitHub
java/gust/backend/model/ObjectModelSerializer.kt

Summary

Maintainability
F
5 days
Test Coverage

Method collapseMessage has a Cognitive Complexity of 123 (exceeds 50 allowed). Consider refactoring.
Open

  /**
   * Recursive boundary for message collapsing operations. "Collapsing" a message refers to converting it into a
   * serialized set of operations, each of which represents an interaction with underlying storage, and collectively
   * which, define the underlying set of writes that constitute the materialized entity being written.
   *
Severity: Minor
Found in java/gust/backend/model/ObjectModelSerializer.kt - About 1 day 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 extractSubmessage has a Cognitive Complexity of 107 (exceeds 50 allowed). Consider refactoring.
Open

  /**
   * Extract a sub-message field, where a potential value means we may need to recurse and decode it, too. In cases
   * where the sub-message is a default value, only recurse if we are directed by configuration to include default
   * values while serializing.
   *
Severity: Minor
Found in java/gust/backend/model/ObjectModelSerializer.kt - About 1 day 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 scanForParent has a Cognitive Complexity of 98 (exceeds 50 allowed). Consider refactoring.
Open

  /**
   * Find the parent field, and potentially parent ID value, for a given message. The `PARENT` annotation should be
   * affixed to an object field, which itself makes reference to an `ID`-annotated property. Find this ID property, and
   * extract its value. Return a triple of the value, the object it was mounted on, and the field descriptor describing
   * the field that contained the ID.
Severity: Minor
Found in java/gust/backend/model/ObjectModelSerializer.kt - About 1 day 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 scanForIdProperty has a Cognitive Complexity of 87 (exceeds 50 allowed). Consider refactoring.
Open

  /**
   * Find the ID field, value, and entity for a given message. If the ID field is nested inside a key object, find it
   * anyway. Return a triple of the found ID, message it was mounted on, and field descriptor, if it could be found,
   * otherwise null in each case or where things could not be found.
   *
Severity: Minor
Found in java/gust/backend/model/ObjectModelSerializer.kt - About 6 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 extractAndSetValue has a Cognitive Complexity of 68 (exceeds 50 allowed). Consider refactoring.
Open

  /**
   * Extract a value from the given concrete message object, at the specified field. If there is a value, and it is
   * eligible to be included (i.e. default values are being included, and it is a default value, or it is not a default
   * value), then set it using the builder method also given.
   *
Severity: Minor
Found in java/gust/backend/model/ObjectModelSerializer.kt - About 3 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

Avoid deeply nested control flow statements.
Open

              if (extractedValue == null) {
                // specify as null
                true to value.setNullValue(NullValue.NULL_VALUE)
              } else if (extractedValue.isEmpty()) {
                // consider treating empty lists as nulls
Severity: Major
Found in java/gust/backend/model/ObjectModelSerializer.kt - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            parentIdScan@ for (subfield in field.messageType.fields) {
              if (subfield.type == FieldType.STRING) {
                // potentially a parent ID
                val subfieldProto = subfield.toProto()
                if (subfieldProto.options.hasExtension(Datamodel.field)) {
Severity: Major
Found in java/gust/backend/model/ObjectModelSerializer.kt - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                for (subfield in keyType.fields) {
                  val subfieldProto = subfield.toProto()
                  if (subfieldProto != null
                    && subfieldProto.hasOptions()
                    && subfieldProto.options.hasExtension(Datamodel.field)) {
Severity: Major
Found in java/gust/backend/model/ObjectModelSerializer.kt - About 45 mins to fix

There are no issues that match your filters.

Category
Status