sgammon/GUST

View on GitHub

Showing 25 of 302 total issues

Method build has a Cognitive Complexity of 277 (exceeds 50 allowed). Consider refactoring.
Open

  /**
   * Load a raw set of mapped data, from underlying storage, into a message builder so that it may be constructed into
   * a concrete Protobuf representation.
   *
   * @param builder
Severity: Minor
Found in java/gust/backend/model/ObjectModelDeserializer.kt - About 4 days 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 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

PageContextManager has 92 methods (exceeds 50 allowed). Consider refactoring.
Open

@RequestScope
@SuppressWarnings("unused")
public class PageContextManager implements Closeable, AutoCloseable, PageRender {
  private static final Logger logging = Logging.logger(PageContextManager.class);

Severity: Major
Found in java/gust/backend/PageContextManager.java - About 1 day to fix

Method convergeColumnField has a Cognitive Complexity of 102 (exceeds 50 allowed). Consider refactoring.
Open

    private void convergeColumnField(@Nonnull Message.Builder target,
                                     @Nonnull Struct source,
                                     @Nonnull ModelMetadata.FieldPointer fieldPointer) {
        // resolve any generic column options and spanner extension options
        var columnOpts = columnOpts(fieldPointer);
Severity: Minor
Found in java/gust/backend/driver/spanner/SpannerStructDeserializer.java - 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 finalizeResponse has a Cognitive Complexity of 101 (exceeds 50 allowed). Consider refactoring.
Open

  @Override
  public @Nonnull <T> MutableHttpResponse<T> finalizeResponse(@Nonnull HttpRequest<?> request,
                                                              @Nonnull MutableHttpResponse<T> soyResponse,
                                                              @Nonnull T body,
                                                              @Nullable MessageDigest digester) {
Severity: Minor
Found in java/gust/backend/PageContextManager.java - 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 bindValueTyped has a Cognitive Complexity of 77 (exceeds 50 allowed). Consider refactoring.
Open

    @SuppressWarnings("unchecked")
    <Primitive> void bindValueTyped(@Nonnull Descriptors.FieldDescriptor field,
                                    @Nonnull ValueBinder<Primitive> valueBinder,
                                    @Nonnull Type columnType,
                                    @Nonnull Object rawValue,
Severity: Minor
Found in java/gust/backend/driver/spanner/SpannerMutationSerializer.java - About 4 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 convergeColumnField has 291 lines of code (exceeds 200 allowed). Consider refactoring.
Open

    private void convergeColumnField(@Nonnull Message.Builder target,
                                     @Nonnull Struct source,
                                     @Nonnull ModelMetadata.FieldPointer fieldPointer) {
        // resolve any generic column options and spanner extension options
        var columnOpts = columnOpts(fieldPointer);
Severity: Major
Found in java/gust/backend/driver/spanner/SpannerStructDeserializer.java - About 4 hrs to fix

ModelMetadata has 61 methods (exceeds 50 allowed). Consider refactoring.
Open

@ThreadSafe
@SuppressWarnings({"WeakerAccess", "unused", "OptionalUsedAsFieldOrParameterType"})
public final class ModelMetadata {
  private ModelMetadata() { /* Disallow construction. */ }

Severity: Major
Found in java/gust/backend/model/ModelMetadata.java - About 3 hrs to fix

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

Method affixHeaders has a Cognitive Complexity of 63 (exceeds 50 allowed). Consider refactoring.
Open

  @SuppressWarnings({"WeakerAccess", "SameParameterValue"})
  protected @Nonnull <T> MutableHttpResponse<T> affixHeaders(@Nonnull MutableHttpResponse<T> response,
                                                             @Nonnull DynamicServingConfiguration config) {
    // first up: content language
    if (this.context.language().isPresent()) {
Severity: Minor
Found in java/gust/backend/AppController.java - 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 compareUnknownFields has a Cognitive Complexity of 61 (exceeds 50 allowed). Consider refactoring.
Open

    private boolean compareUnknownFields(
            Message message1,
            Message message2,
            UnknownFieldSet unknownFieldSet1,
            UnknownFieldSet unknownFieldSet2,
Severity: Minor
Found in java/gust/util/MessageDifferencer.java - 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

Avoid deeply nested control flow statements.
Open

                        if ((reporter == null) || !reportMatches) {
                            continue;
                        }
Severity: Major
Found in java/gust/util/MessageDifferencer.java - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if ((reportType != ReportType.MATCHED) || reportMatches) {
                            reporter.report(reportType, message1, message2, immutable(stack, unknownField));
                        }
Severity: Major
Found in java/gust/util/MessageDifferencer.java - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if (isSet(canonical)) {
              //noinspection OptionalGetWithoutIsPresent
              String lastModifiedValue = lastModified.get();
              if (lastModifiedValue.length() == 10)
                entry.setLastModified(lastModifiedValue);
Severity: Major
Found in java/gust/backend/builtin/SitemapHandler.java - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if (contentDigest.equals(Objects.requireNonNull(request.getHeaders()
                  .get(HttpHeaders.IF_NONE_MATCH))
                .replace("\"", "")
                .replace("W/", ""))) {
              if (logging.isDebugEnabled()) {
Severity: Major
Found in java/gust/backend/PageContextManager.java - 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
Severity
Category
Status
Source
Language