alibaba/transmittable-thread-local

View on GitHub

Showing 208 of 208 total issues

Avoid too many return statements within this method.
Open

        return NO_TRANSFORM;
Severity: Major
Found in ttl-agent/src/main/java/com/alibaba/ttl3/agent/TtlTransformer.java - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return null;

      Avoid too many return statements within this method.
      Open

                  return Arrays.equals((short[]) o1, (short[]) o2);
      Severity: Major
      Found in ttl-core/src/main/java/com/alibaba/ttl3/internal/util/ObjectUtils.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return lineNum + 1;

          Avoid too many return statements within this method.
          Open

                          return nullSafeHashCode((float[]) obj);
          Severity: Major
          Found in ttl-core/src/main/java/com/alibaba/ttl3/internal/util/ObjectUtils.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return nullSafeHashCode((short[]) obj);
            Severity: Major
            Found in ttl-core/src/main/java/com/alibaba/ttl3/internal/util/ObjectUtils.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return classInfo.getCtClass().toBytecode();
              Severity: Major
              Found in ttl-agent/src/main/java/com/alibaba/ttl3/agent/TtlTransformer.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return false;
                Severity: Major
                Found in ttl-core/src/main/java/com/alibaba/ttl3/internal/util/ObjectUtils.java - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return NO_TRANSFORM;

                    Avoid too many return statements within this method.
                    Open

                                    return nullSafeHashCode((long[]) obj);
                    Severity: Major
                    Found in ttl-core/src/main/java/com/alibaba/ttl3/internal/util/ObjectUtils.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return nullSafeHashCode((char[]) obj);
                      Severity: Major
                      Found in ttl-core/src/main/java/com/alibaba/ttl3/internal/util/ObjectUtils.java - About 30 mins to fix

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                            @Nullable
                            @Contract(value = "null -> null; !null -> !null", pure = true)
                            public static ExecutorService getTtlExecutorService(@Nullable ExecutorService executorService) {
                                if (TtlAgentStatus.getInstance().isTtlAgentLoaded() || executorService == null || executorService instanceof TtlEnhanced) {
                                    return executorService;
                        ttl-core/src/main/java/com/alibaba/ttl3/executor/TtlExecutors.java on lines 68..75
                        ttl-core/src/main/java/com/alibaba/ttl3/executor/TtlExecutors.java on lines 107..114

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 40.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                            @Nullable
                            @Contract(value = "null -> null; !null -> !null", pure = true)
                            public static Executor getTtlExecutor(@Nullable Executor executor) {
                                if (TtlAgentStatus.getInstance().isTtlAgentLoaded() || executor == null || executor instanceof TtlEnhanced) {
                                    return executor;
                        ttl-core/src/main/java/com/alibaba/ttl3/executor/TtlExecutors.java on lines 87..94
                        ttl-core/src/main/java/com/alibaba/ttl3/executor/TtlExecutors.java on lines 107..114

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 40.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                            @Nullable
                            @Contract(value = "null -> null; !null -> !null", pure = true)
                            public static ScheduledExecutorService getTtlScheduledExecutorService(@Nullable ScheduledExecutorService scheduledExecutorService) {
                                if (TtlAgentStatus.getInstance().isTtlAgentLoaded() || scheduledExecutorService == null || scheduledExecutorService instanceof TtlEnhanced) {
                                    return scheduledExecutorService;
                        ttl-core/src/main/java/com/alibaba/ttl3/executor/TtlExecutors.java on lines 68..75
                        ttl-core/src/main/java/com/alibaba/ttl3/executor/TtlExecutors.java on lines 87..94

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 40.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Method clear has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @NonNull
                            public Backup clear() {
                                final Object data = callback.beforeReplay();
                        
                                final HashMap<CrrTransmit<Object, Object>, Object> crrTransmit2Value = newHashMap(registeredCrrTransmitSet.size());

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

                                @NonNull
                                public static Object capture() {
                                    final HashMap<Transmittee<Object, Object>, Object> transmittee2Value = new HashMap<>(transmitteeSet.size());
                                    for (Transmittee<Object, Object> transmittee : transmitteeSet) {
                                        try {

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

                                @NonNull
                                public static Object clear() {
                                    final HashMap<Transmittee<Object, Object>, Object> transmittee2Value = new HashMap<>(transmitteeSet.size());
                                    for (Transmittee<Object, Object> transmittee : transmitteeSet) {
                                        try {

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

                            @Override
                            public void doTransform(@NonNull final ClassInfo classInfo) throws IOException, NotFoundException, CannotCompileException {
                                // work-around ClassCircularityError:
                                if (isClassAtPackageJavaUtil(classInfo.getClassName())) return;
                        
                        

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

                            @NonNull
                            public Backup replay(@NonNull Capture captured) {
                                final Object data = callback.beforeReplay();
                        
                                final Snapshot capturedSnapshot = (Snapshot) captured;

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

                            private static void mergeToClassLoader2ExtensionTransformlet(
                                Map<ClassLoader, Map<String, TtlTransformlet>> destination, Map<ClassLoader, Set<TtlTransformlet>> loadedTransformlets
                            ) {
                                for (Map.Entry<ClassLoader, Set<TtlTransformlet>> entry : loadedTransformlets.entrySet()) {
                                    final ClassLoader classLoader = entry.getKey();

                        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