pmonks/alfresco-bulk-import

View on GitHub

Showing 111 of 111 total issues

Function startBytesPerSecondChart has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function startBytesPerSecondChart()
{
  log.debug('Starting bytes per second chart...');

  var canvasElement = document.getElementById('bytesPerSecondChart');
Severity: Minor
Found in amp/src/main/amp/web/scripts/bulkimport/bulkimport.js - About 1 hr to fix

    Function startNodesPerSecondChart has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function startNodesPerSecondChart()
    {
      log.debug('Starting nodes per second chart...');
    
      var canvasElement = document.getElementById('nodesPerSecondChart');
    Severity: Minor
    Found in amp/src/main/amp/web/scripts/bulkimport/bulkimport.js - About 1 hr to fix

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

            @Override
            public final void importComplete(BulkImportStatus importStatus)
            {
                if (info(log))
                {

          Method convertPathToNodeRef has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public final static NodeRef convertPathToNodeRef(final ServiceRegistry serviceRegistry, final String path)
                  throws FileNotFoundException
              {
                  // PRECONDITIONS
                  assert serviceRegistry != null                             : "serviceRegistry must not be null";
          Severity: Minor
          Found in amp/src/main/java/org/alfresco/extension/bulkimport/util/Utils.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 run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                  @Override
                  public void run()
                  {
                      try
                      {

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

              public final static NodeRef convertPathToNodeRef(final ServiceRegistry serviceRegistry, final String path)
                  throws FileNotFoundException
              {
                  // PRECONDITIONS
                  assert serviceRegistry != null                             : "serviceRegistry must not be null";
          Severity: Minor
          Found in amp/src/main/java/org/alfresco/extension/bulkimport/util/Utils.java - About 1 hr to fix

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

                  private Pair<List<FilesystemBulkImportItem>, List<FilesystemBulkImportItem>> constructImportItems(final String                                             sourceRelativeParentDirectory,
                                                                                                                    final Map<String, SortedMap<BigDecimal,Pair<File,File>>> categorisedFiles)
                      throws InterruptedException
                  {
                      Pair<List<FilesystemBulkImportItem>, List<FilesystemBulkImportItem>> 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 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 executeImpl has 31 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 toString has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          @Override
                          public String toString()
                          {
                              String result = null;
                              

                    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
                        {

                      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/DataDictionaryWebScript.java on lines 1..75

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

                      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/BulkImportStatusWebScript.java on lines 1..75

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

                      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 executeImpl has 28 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;
                              

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

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

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

                            @Override
                            public void stop()
                            {
                                if (importStatus.inProgress())
                                {

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

                            private synchronized void submitCurrentBatch()
                                throws InterruptedException
                            {
                                // Implement pauses at batch boundaries only
                                pauser.blockIfPaused();

                        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