sgammon/GUST

View on GitHub

Showing 25 of 302 total issues

Avoid deeply nested control flow statements.
Open

              if (dataValue is Map<*, *>) {
                // prepare the sub-builder, then attach to the top-level field
                this.build(subBuilder, dataValue as Map<String, Any>)
                builder.setField(field, subBuilder.build())
              } else {
Severity: Major
Found in java/gust/backend/model/ObjectModelDeserializer.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

Method acquire has 11 arguments (exceeds 10 allowed). Consider refactoring.
Open

            @Nonnull SpannerOptions.Builder baseOptions,
            @Nonnull DatabaseId defaultDatabase,
            @Nonnull @GoogleAPIChannel(service = GoogleService.SPANNER) TransportChannelProvider spannerChannel,
            @Nonnull Optional<CredentialsProvider> credentialsProvider,
            @Nonnull Optional<SpannerOptions.CallCredentialsProvider> callCredentialProvider,
Severity: Major
Found in java/gust/backend/driver/spanner/SpannerAdapter.java - About 35 mins to fix

Avoid too many return statements within this method.
Open

                    return maybeWrapType(pointer, Type.timestamp());
Severity: Major
Found in java/gust/backend/driver/spanner/SpannerUtil.java - About 30 mins to fix

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

  private void affixHeaders(@Nonnull MediaType type,
                            @Nonnull CompressionMode compression,
                            @Nonnull Timestamp modified,
                            @Nonnull AssetManager.ManagedAssetContent asset,
                            @Nonnull MutableHttpResponse response) {
Severity: Minor
Found in java/gust/backend/AssetController.java - 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