pmonks/alfresco-bulk-import

View on GitHub

Showing 111 of 111 total issues

Method loadMetadata has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public final Metadata loadMetadata(final File metadataFile)
    {
        Metadata result = new Metadata();
        

    Method executeImpl has a Cognitive Complexity of 24 (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;
            String targetPath          = 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 executeImpl has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method run has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public void run()
          {
              boolean inPlacePossible = false;
              
      Severity: Major
      Found in amp/src/main/java/org/alfresco/extension/bulkimport/impl/Scanner.java - About 2 hrs to fix

        Method categoriseFile has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            private void categoriseFile(final Map<String, SortedMap<BigDecimal, Pair<File, File>>> categorisedFiles, final File file)
            {
                if (file != null)
                {
                    if (file.canRead())

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

              @Override
              public String toString()
              {
                  final StringBuilder     result         = new StringBuilder(1024);
                  final Collection<Model> dataDictionary = getDataDictionary();

            Method classDefinitionToString has 70 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private String classDefinitionToString(final ClassDefinition definition)
                {
                    StringBuilder result = null;
                    
                    if (definition != null)

              Function getStatusInfo has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getStatusInfo()
              {
                log.debug('Retrieving import status information...');
              
                $.getJSON(statusURI, function(data)
              Severity: Major
              Found in amp/src/main/amp/web/scripts/bulkimport/bulkimport.js - About 2 hrs to fix

                Method scanDirectory has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  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

                    Similar blocks of code found in 2 locations. 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.
                    amp/src/main/java/org/alfresco/extension/bulkimport/webscripts/BulkImportResumeWebScript.java on lines 1..79

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

                    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

                    /*
                     * 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.
                    amp/src/main/java/org/alfresco/extension/bulkimport/webscripts/BulkImportStopWebScript.java on lines 1..80

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

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

                        @Override
                        public void start(final BulkImportSource          source,
                                          final Map<String, List<String>> parameters,
                                          final NodeRef                   target)
                        {

                      Method loadMetadataIfNecessary has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private final synchronized void loadMetadataIfNecessary()
                          {
                              if (cachedMetadata == null)
                              {
                                  cachedMetadata   = metadataLoader.loadMetadata(metadataReference);

                        Method categoriseFile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private void categoriseFile(final Map<String, SortedMap<BigDecimal, Pair<File, File>>> categorisedFiles, final File file)
                            {
                                if (file != null)
                                {
                                    if (file.canRead())

                          Method execute has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Override
                              public void execute(final Runnable command)
                              {
                                  try
                                  {

                            Function refreshTextElements has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function refreshTextElements(cd)
                            {
                              log.debug('Refreshing text elements...');
                            
                              if (cd != null)
                            Severity: Minor
                            Found in amp/src/main/amp/web/scripts/bulkimport/bulkimport.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language