pmonks/alfresco-bulk-import

View on GitHub
amp/src/main/java/org/alfresco/extension/bulkimport/impl/BatchImporterImpl.java

Summary

Maintainability
F
6 days
Test Coverage

Method importVersionMetadata has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    private final void importVersionMetadata(final NodeRef               nodeRef,
                                             final BulkImportItemVersion version,
                                             final boolean               dryRun)
        throws InterruptedException
    {

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

File BatchImporterImpl.java has 494 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (C) 2007 Peter Monks
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.

    Method importVersionContent has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        private final void importVersionContent(final NodeRef               nodeRef,
                                                final BulkImportItemVersion version,
                                                final boolean               dryRun)
            throws InterruptedException
        {

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

        private final NodeRef findOrCreateNode(final NodeRef                               target,
                                               final BulkImportItem<BulkImportItemVersion> item,
                                               final boolean                               replaceExisting,
                                               final boolean                               dryRun)
        {

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

        private final void importVersionMetadata(final NodeRef               nodeRef,
                                                 final BulkImportItemVersion version,
                                                 final boolean               dryRun)
            throws InterruptedException
        {

      Method findOrCreateNode has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private final NodeRef findOrCreateNode(final NodeRef                               target,
                                                 final BulkImportItem<BulkImportItemVersion> item,
                                                 final boolean                               replaceExisting,
                                                 final boolean                               dryRun)
          {

        Method importVersion has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            private final void importVersion(final NodeRef               nodeRef,
                                             final BulkImportItemVersion previousVersion,
                                             final BulkImportItemVersion version,
                                             final boolean               dryRun,
                                             final boolean               onlyOneVersion)

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

            private final void importFile(final NodeRef                               nodeRef,
                                          final BulkImportItem<BulkImportItemVersion> item,
                                          final boolean                               dryRun)
                throws InterruptedException
            {

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

            private final void importVersionContent(final NodeRef               nodeRef,
                                                    final BulkImportItemVersion version,
                                                    final boolean               dryRun)
                throws InterruptedException
            {

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

              private final void importVersion(final NodeRef               nodeRef,
                                               final BulkImportItemVersion previousVersion,
                                               final BulkImportItemVersion version,
                                               final boolean               dryRun,
                                               final boolean               onlyOneVersion)

            Method importItem has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private final void importItem(final NodeRef                               target,
                                              final BulkImportItem<BulkImportItemVersion> item,
                                              final boolean                               replaceExisting,
                                              final boolean                               dryRun)
                    throws InterruptedException

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

                  private final void importFile(final NodeRef                               nodeRef,
                                                final BulkImportItem<BulkImportItemVersion> item,
                                                final boolean                               dryRun)
                      throws InterruptedException
                  {

                Method importDirectory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    private final void importDirectory(final NodeRef                               nodeRef,
                                                       final BulkImportItem<BulkImportItemVersion> item,
                                                       final boolean                               dryRun)
                        throws InterruptedException
                    {

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

                    private final void importItem(final NodeRef                               target,
                                                  final BulkImportItem<BulkImportItemVersion> item,
                                                  final boolean                               replaceExisting,
                                                  final boolean                               dryRun)
                        throws InterruptedException

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

                    private NodeRef getParent(final NodeRef target, final BulkImportItem<BulkImportItemVersion> item)
                    {
                        NodeRef result = null;
                        
                        final String itemParentPath         = item.getRelativePathOfParent();

                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 importVersion has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    private final void importVersion(final NodeRef               nodeRef,
                                                     final BulkImportItemVersion previousVersion,
                                                     final BulkImportItemVersion version,
                                                     final boolean               dryRun,
                                                     final boolean               onlyOneVersion)

                  Method importBatch has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public final void importBatch(final String  userId,
                                                    final NodeRef target,
                                                    final Batch   batch,
                                                    final boolean replaceExisting,
                                                    final boolean dryRun)

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

                        private final void importBatchImpl(final NodeRef target,
                                                           final Batch   batch,
                                                           final boolean replaceExisting,
                                                           final boolean dryRun)
                            throws InterruptedException

                    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

                                    if (info(log)) info(log, "[DRY RUN] Would have created new node of type '" + String.valueOf(itemTypeQName) + "' with qname '" + String.valueOf(nodeQName) + "' within node '" + String.valueOf(parentNodeRef) + "' with parent association '" + String.valueOf(parentAssocQName) + "'.");
                    amp/src/main/java/org/alfresco/extension/bulkimport/impl/BatchImporterImpl.java on lines 287..287

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

                    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

                                    if (trace(log)) trace(log, "Creating new node of type '" + String.valueOf(itemTypeQName) + "' with qname '" + String.valueOf(nodeQName) + "' within node '" + String.valueOf(parentNodeRef) + "' with parent association '" + String.valueOf(parentAssocQName) + "'.");
                    amp/src/main/java/org/alfresco/extension/bulkimport/impl/BatchImporterImpl.java on lines 282..282

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

                    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

                                    if (trace(log)) trace(log, "Creating " + (isMajor ? "major" : "minor") + " version of node '" + String.valueOf(nodeRef) + "'.");
                    amp/src/main/java/org/alfresco/extension/bulkimport/impl/BatchImporterImpl.java on lines 458..458

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

                    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

                                if (info(log)) info(log, "[DRY RUN] Would have created " + (isMajor ? "major" : "minor") + " version of node '" + String.valueOf(nodeRef) + "'.");
                    amp/src/main/java/org/alfresco/extension/bulkimport/impl/BatchImporterImpl.java on lines 469..469

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status