pmonks/alfresco-bulk-import

View on GitHub

Showing 91 of 111 total issues

Method submitBatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private void submitBatch(final Batch batch)
    {
        if (batch        != null &&
            batch.size() >  0)
        {
Severity: Minor
Found in amp/src/main/java/org/alfresco/extension/bulkimport/impl/Scanner.java - About 55 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 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 importStarted has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public void importStarted(final String                       initiatingUserId,
                              final BulkImportSource             source,
                              final String                       targetSpace,
                              final BulkImportThreadPoolExecutor threadPool,
                              final long                         batchWeight,

    Method importStarted has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        void importStarted(String                       initiatingUserId,
                           BulkImportSource             source,
                           String                       targetSpace,
                           BulkImportThreadPoolExecutor threadPool,
                           long                         batchWeight,

      Avoid deeply nested control flow statements.
      Open

                              for (ConstraintDefinition propertyConstraint : propertyConstraints)
                              {
                                  result.append(propertyConstraint.getName().toPrefixString());
                                  result.append(", ");
                              }

        Avoid deeply nested control flow statements.
        Open

                                if (lastVersion.getContentFile() != null)
                                {
                                    scanDirectory(status,
                                                  callback,
                                                  sourceDirectory,

          Avoid deeply nested control flow statements.
          Open

                                  if (propertyDefinition != null)
                                  {
                                      if (propertyDefinition.isMultiValued())
                                      {
                                          // Multi-valued property

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

                @Override
                protected Map<String, Object> executeImpl(final WebScriptRequest request, final Status status, final Cache cache)
                {
                    Map<String, Object> result = null;
                    

            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

            Avoid deeply nested control flow statements.
            Open

                                    for (final String aspectName : aspectNames)
                                    {
                                        result.addAspect(aspectName.trim());
                                    }

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

                    private final static String calculateType(final MetadataLoader metadataLoader,
                                                              final File           contentFile,
                                                              final File           metadataFile,
                                                              final String         typeFolder,
                                                              final String         typeFile)

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

                      private void scanDirectory(final BulkImportSourceStatus status,
                                                 final BulkImportCallback     callback,
                                                 final File                   sourceDirectory,
                                                 final File                   directory,
                                                 final boolean                submitFiles)

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

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

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

                            @Override
                            public boolean shouldFilter(final FilesystemBulkImportItem item)
                            {
                                boolean result = 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 categoriseFiles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private Map<String, SortedMap<BigDecimal, Pair<File, File>>> categoriseFiles(final File[] directoryListing)
                                throws InterruptedException
                            {
                                Map<String, SortedMap<BigDecimal, Pair<File, File>>> result = null;
                                

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

                            @Override
                            @SuppressWarnings({"rawtypes", "unchecked"})
                            public synchronized void submit(final BulkImportItem item)
                                throws InterruptedException
                            {
                        Severity: Minor
                        Found in amp/src/main/java/org/alfresco/extension/bulkimport/impl/Scanner.java - About 35 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 logStatusInfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private final void logStatusInfo()
                            {
                                if (info(log))
                                {
                                    try
                        Severity: Minor
                        Found in amp/src/main/java/org/alfresco/extension/bulkimport/impl/Scanner.java - About 35 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 calculateType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private final static String calculateType(final MetadataLoader metadataLoader,
                                                                      final File           contentFile,
                                                                      final File           metadataFile,
                                                                      final String         typeFolder,
                                                                      final String         typeFile)

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

                            public Pair<List<FilesystemBulkImportItem>, List<FilesystemBulkImportItem>> analyseDirectory(final File sourceDirectory, final File directory)
                                throws InterruptedException
                            {
                                // PRECONDITIONS
                                if (sourceDirectory == null) throw new IllegalArgumentException("sourceDirectory cannot be null.");

                        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