Syndesi/neo4j-sync-bundle

View on GitHub

Showing 38 of 53 total issues

Function onDatabaseSync has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function onDatabaseSync(DatabaseSyncEvent $databaseSyncEvent): void
    {
        foreach ($this->em->getMetadataFactory()->getAllMetadata() as $metadata) {
            /** @psalm-suppress RedundantConditionGivenDocblockType */
            if ($metadata instanceof ClassMetadata) {
Severity: Minor
Found in src/EventListener/DatabaseSyncNodeRelationSubscriber.php - 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

Function denormalize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
    {
        if (isset($context[DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS], $context['not_normalizable_value_exceptions'])) {
            throw new LogicException('Passing a value for "not_normalizable_value_exceptions" context key is not allowed.');
        }
Severity: Minor
Found in src/Serializer/Neo4jSerializer.php - 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 denormalize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
    {
        if (isset($context[DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS], $context['not_normalizable_value_exceptions'])) {
            throw new LogicException('Passing a value for "not_normalizable_value_exceptions" context key is not allowed.');
        }
Severity: Minor
Found in src/Serializer/Neo4jSerializer.php - About 1 hr to fix

    Method normalize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function normalize(mixed $data, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null|
            DateTimeInterface|
            DateInterval|
            Neo4j\Date|
            Neo4j\Time|
    Severity: Minor
    Found in src/Serializer/Neo4jSerializer.php - About 1 hr to fix

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

          public static function createClient(array $config, LoggerInterface $logger): Neo4jClient
          {
              if (!array_key_exists('drivers', $config)) {
                  throw new InvalidConfigurationException('Missing configuration client.drivers');
              }
      Severity: Minor
      Found in src/Service/Neo4jClientFactory.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

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

          public static function build(array $relations, CreateType $createType = CreateType::MERGE): array
          {
              if (empty($relations)) {
                  return [];
              }
      Severity: Minor
      Found in src/Statement/BatchMergeRelationStatementBuilder.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

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

          protected function execute(InputInterface $input, OutputInterface $output): int
          {
              $io = new SymfonyStyle($input, $output);
      
              $event = new GetAllIndicesEvent();
      Severity: Minor
      Found in src/Command/IndexSyncCommand.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

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

          public static function build(Node $node): array
          {
              $statements = [
                  ...MergeNodeStatementBuilder::build($node),
              ];
      Severity: Minor
      Found in src/Statement/CreateOrUpdateNodeWithRelationsStatementBuilder.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 build has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function build(array $nodes): array
          {
              if (empty($nodes)) {
                  return [];
              }
      Severity: Minor
      Found in src/Statement/BatchDeleteRelationsFromNodeStatementBuilder.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 current has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function current(): array
          {
              /** @var class-string $className */
              $className = $this->className;
              $elements = $this->em->getRepository($this->className)
      Severity: Minor
      Found in src/Provider/DatabaseSyncNodeRelationProvider.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 getNeo4jIndices has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getNeo4jIndices(): array
          {
              $res = $this->client->runStatement(GetIndicesStatementBuilder::build()[0]);
              $indices = [];
              foreach ($res as $element) {
      Severity: Minor
      Found in src/Command/IndexListCommand.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 createBatchArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function createBatchArray(array $relations): array
          {
              $batch = [];
              foreach ($relations as $relation) {
                  $identifier = $relation->getIdentifier();
      Severity: Minor
      Found in src/Statement/BatchMergeRelationStatementBuilder.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 $normalized;
      Severity: Major
      Found in src/Serializer/Neo4jSerializer.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $a->isEqualTo($b);
        Severity: Major
        Found in src/Helper/CompareEqualHelper.php - About 30 mins to fix

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

              public function onGetAllIndices(GetAllIndicesEvent $getAllIndicesEvent): void
              {
                  foreach ($this->em->getMetadataFactory()->getAllMetadata() as $metadata) {
                      /** @psalm-suppress RedundantConditionGivenDocblockType */
                      if ($metadata instanceof ClassMetadata) {
          Severity: Minor
          Found in src/EventListener/GetAllIndicesSubscriber.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 onDatabaseSync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function onDatabaseSync(DatabaseSyncEvent $databaseSyncEvent): void
              {
                  foreach ($this->em->getMetadataFactory()->getAllMetadata() as $metadata) {
                      /** @psalm-suppress RedundantConditionGivenDocblockType */
                      if ($metadata instanceof ClassMetadata) {
          Severity: Minor
          Found in src/EventListener/DatabaseSyncNodeSubscriber.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 onDatabaseSync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function onDatabaseSync(DatabaseSyncEvent $databaseSyncEvent): void
              {
                  foreach ($this->em->getMetadataFactory()->getAllMetadata() as $metadata) {
                      /** @psalm-suppress RedundantConditionGivenDocblockType */
                      if ($metadata instanceof ClassMetadata) {
          Severity: Minor
          Found in src/EventListener/DatabaseSyncRelationSubscriber.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 build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function build(array $relations): array
              {
                  if (empty($relations)) {
                      return [];
                  }
          Severity: Minor
          Found in src/Statement/BatchCreateRelationStatementBuilder.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