Showing 25 of 302 total issues
Avoid deeply nested control flow statements. Open
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 {
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
Open
for (subfield in keyType.fields) {
val subfieldProto = subfield.toProto()
if (subfieldProto != null
&& subfieldProto.hasOptions()
&& subfieldProto.options.hasExtension(Datamodel.field)) {
- Create a ticketCreate a ticket
Method acquire
has 11 arguments (exceeds 10 allowed). Consider refactoring. Open
Open
@Nonnull SpannerOptions.Builder baseOptions,
@Nonnull DatabaseId defaultDatabase,
@Nonnull @GoogleAPIChannel(service = GoogleService.SPANNER) TransportChannelProvider spannerChannel,
@Nonnull Optional<CredentialsProvider> credentialsProvider,
@Nonnull Optional<SpannerOptions.CallCredentialsProvider> callCredentialProvider,
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return maybeWrapType(pointer, Type.timestamp());
- Create a ticketCreate a ticket
Method affixHeaders
has a Cognitive Complexity of 51 (exceeds 50 allowed). Consider refactoring. Open
Open
private void affixHeaders(@Nonnull MediaType type,
@Nonnull CompressionMode compression,
@Nonnull Timestamp modified,
@Nonnull AssetManager.ManagedAssetContent asset,
@Nonnull MutableHttpResponse response) {
- Read upRead up
- Create a ticketCreate a ticket
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"