autonomouslogic/dynamo-mapper

View on GitHub

Showing 20 of 67 total issues

File PermutationTester.java has 325 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.autonomouslogic.dynamomapper;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

    Method testDelete has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @SneakyThrows
        private MappedDeleteItemResponse<IntegrationTestObject> testDelete(IntegrationTestObject obj) {
            var key = encoder.encodeKeyValue(obj);
            switch (methodType) {
                case REQUEST:

      Method shouldPutAndGetAndUpdateAndDelete has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @ParameterizedTest
          @MethodSource("com.autonomouslogic.dynamomapper.PermutationTester#objectAndTestMethods")
          @SneakyThrows
          void shouldPutAndGetAndUpdateAndDelete(PermutationTester.ObjectAndTestMethod test) {
              var obj = IntegrationTestObjects.setKeyAndTtl(test.obj());

        Method testGet has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @SneakyThrows
            private MappedGetItemResponse<IntegrationTestObject> testGet(IntegrationTestObject obj) {
                var key = encoder.encodeKeyValue(obj);
                switch (methodType) {
                    case REQUEST:

          Method internalGenerateDelegateWrapper has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected MethodSpec internalGenerateDelegateWrapper(
                      Method method,
                      TypeName outerReturnType,
                      TypeName innerReturnType,
                      String decoderMethod,

            Method generate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public MethodSpec generate() {
                    // Create signature.
                    var wrapper = MethodSpec.methodBuilder(methodNameFactory.create(method, "FromKeyObject", multiple))
                            .addModifiers(Modifier.PUBLIC)
                            .addTypeVariable(TypeHelper.T);

              Method testUpdate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @SneakyThrows
                  private MappedUpdateItemResponse<IntegrationTestObject> testUpdate(IntegrationTestObject obj) {
                      var key = encoder.encodeKeyValue(obj);
                      var updates = encoder.encodeUpdates(obj);
                      switch (methodType) {

                Method generate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public MethodSpec generate() {
                        // Create signature.
                        var wrapper = MethodSpec.methodBuilder(methodNameFactory.create(method, "FromPrimaryKey", multiple))
                                .addModifiers(Modifier.PUBLIC)
                                .addTypeVariable(TypeHelper.T);

                  Method generate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public MethodSpec generate() {
                          // Create signature.
                          var wrapper = MethodSpec.methodBuilder(methodNameFactory.create(method, "FromKeyObject", multiple))
                                  .addModifiers(Modifier.PUBLIC)
                                  .addTypeVariable(TypeHelper.T);

                    Method testPut has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @SneakyThrows
                        private MappedPutItemResponse<IntegrationTestObject> testPut(IntegrationTestObject obj) {
                            var item = encoder.encode(obj);
                            switch (methodType) {
                                case REQUEST:

                      Method shouldPutAndGetAndUpdateAndDelete has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          @ParameterizedTest
                          @MethodSource("com.autonomouslogic.dynamomapper.PermutationTester#objectAndTestMethods")
                          @SneakyThrows
                          void shouldPutAndGetAndUpdateAndDelete(PermutationTester.ObjectAndTestMethod test) {
                              var obj = IntegrationTestObjects.setKeyAndTtl(test.obj());

                        Method generate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public MethodSpec generate() {
                                var requestVar = detectRequestOrConsumer(method);
                                // Create signature.
                                var wrapper = MethodSpec.methodBuilder(method.getName())
                                        .addModifiers(Modifier.PUBLIC)

                          Method run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @TaskAction
                              @SneakyThrows
                              public void run() {
                                  log = getLogger();
                                  srcDir = getProject()

                            Method encodeValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public AttributeValue encodeValue(JsonNode node) throws IOException {
                                    if (node == null || node.isNull()) {
                                        return AttributeValue.builder().nul(true).build();
                                    }
                                    if (node.isBinary()) {
                            Severity: Minor
                            Found in src/main/java/com/autonomouslogic/dynamomapper/codec/DynamoEncoder.java - About 45 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

                            Method internalGenerateDelegateWrapper has 7 arguments (exceeds 6 allowed). Consider refactoring.
                            Open

                                        Method method,
                                        TypeName outerReturnType,
                                        TypeName innerReturnType,
                                        String decoderMethod,
                                        Class<?> requestClass,

                              Method testGet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  @SneakyThrows
                                  private MappedGetItemResponse<IntegrationTestObject> testGet(IntegrationTestObject obj) {
                                      var key = encoder.encodeKeyValue(obj);
                                      switch (methodType) {
                                          case REQUEST:

                              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 testDelete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  @SneakyThrows
                                  private MappedDeleteItemResponse<IntegrationTestObject> testDelete(IntegrationTestObject obj) {
                                      var key = encoder.encodeKeyValue(obj);
                                      switch (methodType) {
                                          case REQUEST:

                              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 generate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public MethodSpec generate() {
                                      // Create signature.
                                      var wrapper = MethodSpec.methodBuilder(methodNameFactory.create(method, "FromKeyObject", multiple))
                                              .addModifiers(Modifier.PUBLIC)
                                              .addTypeVariable(TypeHelper.T);

                              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 generate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public MethodSpec generate() {
                                      // Create signature.
                                      var wrapper = MethodSpec.methodBuilder(methodNameFactory.create(method, "FromPrimaryKey", multiple))
                                              .addModifiers(Modifier.PUBLIC)
                                              .addTypeVariable(TypeHelper.T);

                              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 runTest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public void runTest() {
                                      // Get
                                      var emptyGetResponse = testGet(obj);
                                      assertNull(emptyGetResponse.item());
                                      // Put.

                              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