adgadev/jplusone

View on GitHub

Showing 18 of 18 total issues

Method format has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public String format(SessionNodeView session) {
        StringBuilder builder = new StringBuilder();
        builder.append(NEWLINE + INDENTS.get(1) + "ROOT");

        List<FrameExtract> sessionCallFrames = session.getSessionFrameStack().getCallFrames();

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 main has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static void main(String args[]) {
        System.out.println("- Downloader started");
        File baseDirectory = new File(args[0]);
        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

Severity: Minor
Found in .mvn/wrapper/MavenWrapperDownloader.java - About 1 hr to fix

    Method format has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public String format(SessionNodeView session) {
            StringBuilder builder = new StringBuilder();
            builder.append(NEWLINE + INDENTS.get(1) + "ROOT");
    
            List<FrameExtract> sessionCallFrames = session.getSessionFrameStack().getCallFrames();

      Method formatSelectSqlStatement has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static String formatSelectSqlStatement(String generalIntend, String[] lines) {
              StringBuilder builder = new StringBuilder();
              boolean whereClauseProcessed = false;
      
              builder.append('\n');

        Method main has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public static void main(String args[]) {
                System.out.println("- Downloader started");
                File baseDirectory = new File(args[0]);
                System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
        
        
        Severity: Minor
        Found in .mvn/wrapper/MavenWrapperDownloader.java - About 1 hr 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 formatSelectSqlStatement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            static String formatSelectSqlStatement(String generalIntend, String[] lines) {
                StringBuilder builder = new StringBuilder();
                boolean whereClauseProcessed = false;
        
                builder.append('\n');

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

            @Override
            public void statementExecuted(String sql) {
                if (verbosityLevel.isDebugModeEnabled()) {
                    if (verbosityLevel.isSqlStatementStackVisible()) {
                        String label = verbosityLevel.isSqlStatementVisible()

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

            private List<FrameExtract> filterApplicationCallFrames(List<FrameExtract> callFrames, boolean proxyCallFramesHidden) {
                List<FrameExtract> applicationAllCallFrames = filterToList(callFrames, FrameExtract::isNotThirdPartyClass);
        
                if (!proxyCallFramesHidden) {
                    return applicationAllCallFrames;

        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

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

            @Override
            public void entityManagerCreated(Identifier entityManagerId) {
                if (verbosityLevel.isDebugModeEnabled()) {
                    if (verbosityLevel.isSessionStackVisible()) {
                        framesProvider.captureCallFrames().printStackTrace("JPA EntityManager created, ID: " + entityManagerId);
        jplusone-core/src/main/java/com/adgadev/jplusone/core/tracking/LoggingStateListener.java on lines 54..65

        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 54.

        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 2 locations. Consider refactoring.
        Open

            @Override
            public void entityManagerClosed(Identifier entityManagerId) {
                if (verbosityLevel.isDebugModeEnabled()) {
                    if (verbosityLevel.isSessionStackVisible()) {
                        framesProvider.captureCallFrames().printStackTrace("JPA EntityManager closed, ID: " + entityManagerId);
        jplusone-core/src/main/java/com/adgadev/jplusone/core/tracking/LoggingStateListener.java on lines 41..52

        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 54.

        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 2 locations. Consider refactoring.
        Open

            private ConditionDoneBuilder exceptOf(Function<ExplicitOperationExclusionBuilder, ExplicitOperationExclusionBuilder> exclusions,
                                                  ExclusionJoiningMode joiningMode) {
                OperationExclusionList operationExclusionList = OperationExclusionList.of(joiningMode);
                condition.setOperationExclusionList(operationExclusionList);
        
        
        jplusone-assert/src/main/java/com/adgadev/jplusone/asserts/impl/ExtendedImplicitOperationExclusionBuilderImpl.java on lines 77..86

        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 49.

        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 2 locations. Consider refactoring.
        Open

            private ConditionDoneBuilder exceptOf(Function<ImplicitOperationExclusionBuilder, ImplicitOperationExclusionBuilder> exclusions,
                                                  ExclusionJoiningMode joiningMode) {
                OperationExclusionList operationExclusionList = OperationExclusionList.of(joiningMode);
                condition.setOperationExclusionList(operationExclusionList);
        
        
        jplusone-assert/src/main/java/com/adgadev/jplusone/asserts/impl/ExtendedExplicitOperationExclusionBuilderImpl.java on lines 77..86

        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 49.

        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 2 locations. Consider refactoring.
        Open

                        for (FrameExtract frame : filterApplicationCallFrames(operationCallFrames, proxyCallFramesHidden)) {
                            if (frame.isNotThirdPartyClass()) {
                                builder.append(NEWLINE + INDENTS.get(5));
                                builder.append(frame.format());
                            }
        jplusone-core/src/main/java/com/adgadev/jplusone/core/report/SessionFormatter.java on lines 65..70

        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 48.

        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 2 locations. Consider refactoring.
        Open

                for (FrameExtract frame : filterApplicationCallFrames(sessionCallFrames, proxyCallFramesHidden)) {
                    if (frame.isNotThirdPartyClass()) {
                        builder.append(NEWLINE + INDENTS.get(2));
                        builder.append(frame.format());
                    }
        jplusone-core/src/main/java/com/adgadev/jplusone/core/report/SessionFormatter.java on lines 81..86

        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 48.

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

            public List<OperationNodeView> filter(List<OperationNodeView> initialOperations) {
                List<OperationNodeView> operations = initialOperations;
                Set<OperationNodeView> excludedOperations = new HashSet<>();
        
                for (OperationExclusion exclusion : exclusions) {

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

            String getSqlWithParameters() {
                StringBuilder builder = new StringBuilder();
                int parameterIndex = 0;
                int startIndex = 0;
                int endIndex = -1;

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

            public static <T> List<T> getMaxCommonHeadFragmentOfLists(List<T> firstList, List<T> secondList) {
                Iterator<T> firstIterator = firstList.iterator();
                Iterator<T> secondIterator = secondList.iterator();
                int amountOfSameItems = 0;
                boolean differenceFound = false;

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

            void addLazyInitialisation(LazyInitialisation lazyInitialisation) {
                if (this.lazyInitialisations.isEmpty()) {
                    this.lazyInitialisations.add(lazyInitialisation);
        
                    if (operationType == OperationType.EXPLICIT) {

        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