GetDKAN/dkan

View on GitHub

Showing 21 of 90 total issues

Data has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class Data implements MetastoreItemInterface {

  /**
   * Node.
   *
Severity: Minor
Found in modules/metastore/src/NodeWrapper/Data.php - About 2 hrs to fix

    ComplexDataFacade has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class ComplexDataFacade implements \Iterator, ComplexDataInterface {
    
      /**
       * Inherited.
       *

      File DashboardForm.php has 275 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Drupal\datastore\Form;
      
      use Drupal\Core\Pager\PagerManagerInterface;
      Severity: Minor
      Found in modules/datastore/src/Form/DashboardForm.php - About 2 hrs to fix

        AbstractDatabaseTable has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        abstract class AbstractDatabaseTable implements DatabaseTableInterface {
          use EventDispatcherTrait;
        
          /**
           * The event name we send when we create a table.
        Severity: Minor
        Found in modules/common/src/Storage/AbstractDatabaseTable.php - About 2 hrs to fix

          Data has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          abstract class Data implements MetastoreEntityStorageInterface {
          
            /**
             * Entity type manager.
             *
          Severity: Minor
          Found in modules/metastore/src/Storage/Data.php - About 2 hrs to fix

            ResourcePurger has 21 functions (exceeds 20 allowed). Consider refactoring.
            Confirmed

            class ResourcePurger implements ContainerInjectionInterface {
            
              /**
               * The datastore.settings config.
               *
            Severity: Minor
            Found in modules/datastore/src/Service/ResourcePurger.php - About 2 hrs to fix

              Method __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  array $configuration,
                  $plugin_id,
                  $plugin_definition,
                  AlterTableQueryBuilderInterface $alter_table_query_builder,
                  LoggerInterface $logger_channel,

                Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    $plugin_id,
                    $plugin_definition,
                    FieldDefinitionInterface $field_definition,
                    array $settings,
                    array $third_party_settings,

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

                      array $configuration,
                      $pluginId,
                      $pluginDefinition,
                      LoggerInterface $loggerChannel,
                      MessengerInterface $messenger,

                    Method getFormElement has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      public function getFormElement($type, $definition, $data, $object_schema = NULL, $form_state = NULL, array $context = []) {
                    Severity: Minor
                    Found in modules/json_form_widget/src/FieldTypeRouter.php - About 45 mins to fix

                      Function expandDirectories has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        private function expandDirectories($base_dir) {
                          $directories = [];
                      
                          if (!file_exists($base_dir)) {
                            return $directories;
                      Severity: Minor
                      Found in modules/frontend/src/Routing/RouteProvider.php - About 45 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

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                        public function archive($harvestId) {
                          $this->validateHarvestId($harvestId);
                          $result = $this->harvestService->archive($harvestId);
                          if (empty($result)) {
                            (new ConsoleOutput())->write("No items available to archive for the '{$harvestId}' harvest plan." . PHP_EOL);
                      Severity: Minor
                      Found in modules/harvest/src/Commands/HarvestCommands.php and 1 other location - About 45 mins to fix
                      modules/harvest/src/Commands/HarvestCommands.php on lines 279..288

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

                      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

                        public function publish($harvestId) {
                          $this->validateHarvestId($harvestId);
                          $result = $this->harvestService->publish($harvestId);
                          if (empty($result)) {
                            (new ConsoleOutput())->write("No items available to publish for the '{$harvestId}' harvest plan." . PHP_EOL);
                      Severity: Minor
                      Found in modules/harvest/src/Commands/HarvestCommands.php and 1 other location - About 45 mins to fix
                      modules/harvest/src/Commands/HarvestCommands.php on lines 257..266

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

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

                        public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
                      Severity: Minor
                      Found in modules/json_form_widget/src/Plugin/Field/FieldWidget/JsonFormWidget.php - About 35 mins to fix

                        The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple lines
                        Open

                            foreach ($query_fields as ['name' => $col, 'type' => $type, 'format' => $format]) {

                        Unused use statement
                        Open

                        use Drupal\datastore\DataDictionary\AlterTableQuery\MySQLQuery;

                        Parameter $options is not described in comment
                        Open

                          /**

                        Line exceeds 80 characters; contains 87 characters
                        Open

                           * Remove query indexes with fields not found in the given table and copy over names.

                        Unused use statement
                        Open

                        use Drupal\datastore\DataDictionary\AlterTableQueryInterface;

                        Function flattenValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          public function flattenValues($formValues, $property, $schema) {
                            $data = [];
                        
                            switch ($schema->type) {
                              case 'string':
                        Severity: Minor
                        Found in modules/json_form_widget/src/ValueHandler.php - About 25 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