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

    public final static String convertNodeRefToPath(final ServiceRegistry serviceRegistry, final NodeRef nodeRef)
    {
        String result = null;
        
        if (nodeRef != null)
Severity: Minor
Found in amp/src/main/java/org/alfresco/extension/bulkimport/util/Utils.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 importStarted has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

    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,

      Avoid deeply nested control flow statements.
      Open

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

        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,

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

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

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

                        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

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

                            @Override
                            public void init(final BulkImportSourceStatus importStatus, final Map<String, List<String>> parameters)
                            {
                                final List<String> sourceDirectoryParameterValues = parameters.get(PARAMETER_SOURCE_DIRECTORY);
                                String             sourceDirectoryName            = 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 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

                        Severity
                        Category
                        Status
                        Source
                        Language