gdbots/ncr-php

View on GitHub

Showing 72 of 92 total issues

File Aggregate.php has 665 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
declare(strict_types=1);

namespace Gdbots\Ncr;

Severity: Major
Found in src/Aggregate.php - About 1 day to fix

    File DynamoDbNcr.php has 585 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    declare(strict_types=1);
    
    namespace Gdbots\Ncr\Repository\DynamoDb;
    
    
    Severity: Major
    Found in src/Repository/DynamoDb/DynamoDbNcr.php - About 1 day to fix

      Aggregate has 62 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Aggregate
      {
          protected Message $node;
          protected NodeRef $nodeRef;
          protected Pbjx $pbjx;
      Severity: Major
      Found in src/Aggregate.php - About 1 day to fix

        Method doPipeNodes has 162 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function doPipeNodes(SchemaQName $qname, array $context): \Generator
            {
                static $alreadyPiped = [];
        
                $tableName = $context['table_name'] ?? $this->tableManager->getNodeTableName($qname, $context);
        Severity: Major
        Found in src/Repository/DynamoDb/DynamoDbNcr.php - About 6 hrs to fix

          Function getNodes has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
          Open

              final public function getNodes(array $nodeRefs, bool $consistent = false, array $context = []): array
              {
                  if (empty($nodeRefs)) {
                      return [];
                  } elseif (count($nodeRefs) === 1) {
          Severity: Minor
          Found in src/Repository/Psr6Ncr.php - About 6 hrs 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

          Function derefNodes has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

              public function derefNodes(Message $node, array $fields, ?string $return = null): array
              {
                  $nodeRefs = [];
                  foreach ($fields as $field) {
                      if (!$node->has($field)) {
          Severity: Minor
          Found in src/NcrCache.php - About 4 hrs 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

          Function doPipeNodes has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              private function doPipeNodes(SchemaQName $qname, array $context): \Generator
              {
                  static $alreadyPiped = [];
          
                  $tableName = $context['table_name'] ?? $this->tableManager->getNodeTableName($qname, $context);
          Severity: Minor
          Found in src/Repository/DynamoDb/DynamoDbNcr.php - About 3 hrs 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 findNodeRefs has 79 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function findNodeRefs(IndexQuery $query, array $context = []): IndexQueryResult
              {
                  $context = $this->enrichContext(__FUNCTION__, $context);
                  $tableName = $this->tableManager->getNodeTableName($query->getQName(), $context);
                  $table = $this->tableManager->getNodeTable($query->getQName());
          Severity: Major
          Found in src/Repository/DynamoDb/DynamoDbNcr.php - About 3 hrs to fix

            Function findNodeRefs has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public function findNodeRefs(IndexQuery $query, array $context = []): IndexQueryResult
                {
                    $context = $this->enrichContext(__FUNCTION__, $context);
                    $tableName = $this->tableManager->getNodeTableName($query->getQName(), $context);
                    $table = $this->tableManager->getNodeTable($query->getQName());
            Severity: Minor
            Found in src/Repository/DynamoDb/DynamoDbNcr.php - About 2 hrs 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

            Function addEmbeddedNodeRefs has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public function addEmbeddedNodeRefs(array $messages, array $paths): void
                {
                    $nodeRefs = [];
            
                    if (array_is_list($paths)) {
            Severity: Minor
            Found in src/NcrLazyLoader.php - About 2 hrs 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

            Function addEmbeddedNodeRefs has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public function addEmbeddedNodeRefs(array $messages, array $paths, string $namespace = self::DEFAULT_NAMESPACE): void
                {
                    $nodeRefs = [];
            
                    if (array_is_list($paths)) {
            Severity: Minor
            Found in src/NcrPreloader.php - About 2 hrs 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

            File ElasticaNcrSearch.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            declare(strict_types=1);
            
            namespace Gdbots\Ncr\Search\Elastica;
            
            
            Severity: Minor
            Found in src/Search/Elastica/ElasticaNcrSearch.php - About 2 hrs to fix

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

                  final public function getNodes(array $nodeRefs, bool $consistent = false, array $context = []): array
                  {
                      if (empty($nodeRefs)) {
                          return [];
                      } elseif (count($nodeRefs) === 1) {
              Severity: Major
              Found in src/Repository/Psr6Ncr.php - About 2 hrs to fix

                Method searchNodes has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function searchNodes(Message $request, ParsedQuery $parsedQuery, Message $response, array $qnames = [], array $context = []): void
                    {
                        $context = $this->enrichContext(__FUNCTION__, $context);
                        $skipValidation = filter_var($context['skip_validation'] ?? true, FILTER_VALIDATE_BOOLEAN);
                        $client = $this->getClientForRead($context);
                Severity: Major
                Found in src/Search/Elastica/ElasticaNcrSearch.php - About 2 hrs to fix

                  Function getNode has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      final public function getNode(NodeRef $nodeRef, bool $consistent = false, array $context = []): Message
                      {
                          $cacheKey = $this->getCacheKey($nodeRef, $context);
                          $cacheItem = null;
                  
                  
                  Severity: Minor
                  Found in src/Repository/Psr6Ncr.php - About 2 hrs 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 createQuery has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      final public function createQuery(IndexQuery $query): array
                      {
                          $filterables = $this->getFilterableAttributes();
                          $params = [
                              'IndexName'                 => $this->getName(),
                  Severity: Major
                  Found in src/Repository/DynamoDb/AbstractIndex.php - About 2 hrs to fix

                    Method indexNodes has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function indexNodes(array $nodes, array $context = []): void
                        {
                            if (empty($nodes)) {
                                return;
                            }
                    Severity: Major
                    Found in src/Search/Elastica/ElasticaNcrSearch.php - About 2 hrs to fix

                      Method createIndex has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          final public function createIndex(Client $client, SchemaQName $qname, array $context = []): Index
                          {
                              static $created = [];
                      
                              $indexName = $this->getIndexName($qname, $context);
                      Severity: Major
                      Found in src/Search/Elastica/IndexManager.php - About 2 hrs to fix

                        Method getNode has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getNode(NodeRef $nodeRef, bool $consistent = false, array $context = []): Message
                            {
                                $context = $this->enrichContext(__FUNCTION__, $context);
                                $tableName = $this->tableManager->getNodeTableName($nodeRef->getQName(), $context);
                        
                        
                        Severity: Major
                        Found in src/Repository/DynamoDb/DynamoDbNcr.php - About 2 hrs to fix

                          Method create has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              final public function create(DynamoDbClient $client, string $tableName): void
                              {
                                  try {
                                      $client->describeTable(['TableName' => $tableName]);
                                      return;
                          Severity: Major
                          Found in src/Repository/DynamoDb/NodeTable.php - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language