gdbots/ncr-php

View on GitHub

Showing 92 of 92 total issues

Function create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    final public function create(DynamoDbClient $client, string $tableName): void
    {
        try {
            $client->describeTable(['TableName' => $tableName]);
            return;
Severity: Minor
Found in src/Repository/DynamoDb/NodeTable.php - About 35 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

Function deleteNodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleteNodes(array $nodeRefs, array $context = []): void
    {
        if (empty($nodeRefs)) {
            return;
        }
Severity: Minor
Found in src/Search/Elastica/ElasticaNcrSearch.php - About 35 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

Function indexNodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function indexNodes(array $nodes, array $context = []): void
    {
        if (empty($nodes)) {
            return;
        }
Severity: Minor
Found in src/Search/Elastica/ElasticaNcrSearch.php - About 35 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

Avoid too many return statements within this method.
Open

                return $value <= $filter->getValue();
Severity: Major
Found in src/IndexQueryFilterProcessor.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return $value < $filter->getValue();
    Severity: Major
    Found in src/IndexQueryFilterProcessor.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return $nodes;
      Severity: Major
      Found in src/Repository/Psr6Ncr.php - About 30 mins to fix

        Function searchNodes has a Cognitive Complexity of 6 (exceeds 5 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: Minor
        Found in src/Search/Elastica/ElasticaNcrSearch.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

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

            public function getNodes(?callable $filter = null, string $namespace = self::DEFAULT_NAMESPACE): array
            {
                $nodes = [];
                $nodeRefs = $this->nodeRefs[$namespace] ?? [];
        
        
        Severity: Minor
        Found in src/NcrPreloader.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

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

            public function onGetNodeBatchRequestBeforeHandle(GetResponseEvent $pbjxEvent): void
            {
                $request = $pbjxEvent->getRequest();
                if ($request->get('consistent_read') || !$request->has('node_refs')) {
                    return;
        Severity: Minor
        Found in src/NcrRequestInterceptor.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

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

            public function pipeNodes(SchemaQName $qname, array $context = []): \Generator
            {
                foreach ($this->nodes as $nodeRef => $node) {
                    if ($node->isFrozen()) {
                        $this->nodes[$nodeRef] = clone $node;
        Severity: Minor
        Found in src/Repository/InMemoryNcr.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

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

            protected function getNode(PbjxEvent $pbjxEvent): Message
            {
                $command = $pbjxEvent->getMessage();
                Assertion::true($command->has('node_ref'), 'Field "node_ref" is required.', 'node_ref');
        
        
        Severity: Minor
        Found in src/NodeCommandBinder.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

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

            public function validateCreateNode(PbjxEvent $pbjxEvent): void
            {
                $command = $pbjxEvent->getMessage();
                if (!$command->has('node')) {
                    return;
        Severity: Minor
        Found in src/NodeIdempotencyValidator.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