GetDKAN/dkan

View on GitHub

Showing 13 of 25 total issues

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

class Service implements ContainerInjectionInterface {
  use EventDispatcherTrait;
  use LoggerTrait;

  const EVENT_DATA_GET = 'dkan_metastore_data_get';
Severity: Minor
Found in modules/metastore/src/Service.php - About 2 hrs to fix

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

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

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

        public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, FormBuilder $builder, ValueHandler $value_handler) {
      Severity: Major
      Found in modules/json_form_widget/src/Plugin/Field/FieldWidget/JsonFormWidget.php - About 50 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

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

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

          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

            Variable $identifier is undefined.
            Open

                  [$identifier, $metadata] = $this->decodeJsonMetadata($item);

            Doc comment short description must end with a full stop
            Open

               * {@inheritDoc}

            Variable $identifier is undefined.
            Open

                    $referencers[] = $identifier;

            Variable $metadata is undefined.
            Open

                  $propertyValue = $metadata->{$propertyId};

            Doc comment short description must start with a capital letter
            Open

               * {@inheritDoc}

            Variable $metadata is undefined.
            Open

                  [$identifier, $metadata] = $this->decodeJsonMetadata($item);

            Function generateTableHeaders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Confirmed

              private function generateTableHeaders(array $columns): array {
                $headers = [];
            
                foreach ($columns as $column) {
                  // Sanitize the supplied table header to generate a unique column name;

            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