gdbots/ncr-bundle-php

View on GitHub

Showing 34 of 38 total issues

Method configure has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function configure(): void
    {
        $provider = $this->container->getParameter('gdbots_ncr.ncr_search.provider');

        $this
Severity: Minor
Found in src/Command/CreateSearchStorageCommand.php - About 1 hr to fix

    Function reindex has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function reindex(array $nodes, array $context, bool $skipErrors): int
        {
            $count = count($nodes);
            if ($count === 0) {
                return 0;
    Severity: Minor
    Found in src/Command/ReindexNodesCommand.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 execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output): int
        {
            $errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
            $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
            $errOutput->setVerbosity(OutputInterface::VERBOSITY_NORMAL);
    Severity: Minor
    Found in src/Command/ExportNodesCommand.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 execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output): int
        {
            $skipErrors = $input->getOption('skip-errors');
            $context = $input->getOption('context') ?: '{}';
            if (!str_contains($context, '{')) {
    Severity: Minor
    Found in src/Command/CreateSearchStorageCommand.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 execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output): int
        {
            $skipErrors = $input->getOption('skip-errors');
            $context = $input->getOption('context') ?: '{}';
            if (!str_contains($context, '{')) {
    Severity: Minor
    Found in src/Command/CreateStorageCommand.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 configure has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function configure(): void
        {
            $provider = $this->container->getParameter('gdbots_ncr.ncr_search.provider');
    
            $this
    Severity: Minor
    Found in src/Command/DescribeSearchStorageCommand.php - About 1 hr to fix

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

          protected function configure(): void
          {
              $provider = $this->container->getParameter('gdbots_ncr.ncr.provider');
      
              $this
      Severity: Minor
      Found in src/Command/DescribeStorageCommand.php - About 1 hr to fix

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

            protected function reindexBatch(SymfonyStyle $io, array $nodes, array $context, int $batch, bool $dryRun, bool $skipErrors): int
        Severity: Minor
        Found in src/Command/ReindexNodesCommand.php - About 45 mins to fix

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

              protected function execute(InputInterface $input, OutputInterface $output): int
              {
                  $context = $input->getOption('context') ?: '{}';
                  if (!str_contains($context, '{')) {
                      $context = base64_decode($context);
          Severity: Minor
          Found in src/Command/DescribeStorageCommand.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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output): int
              {
                  $dryRun = $input->getOption('dry-run');
                  $skipErrors = $input->getOption('skip-errors');
                  $batchSize = NumberUtil::bound((int)$input->getOption('batch-size'), 1, 2000);
          Severity: Minor
          Found in src/Command/ReindexNodesCommand.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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output): int
              {
                  $context = $input->getOption('context') ?: '{}';
                  if (!str_contains($context, '{')) {
                      $context = base64_decode($context);
          Severity: Minor
          Found in src/Command/DescribeSearchStorageCommand.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 NodeRef::fromString((string)$val);
          Severity: Major
          Found in src/Twig/NcrExtension.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return null;
            Severity: Major
            Found in src/Twig/NcrExtension.php - About 30 mins to fix

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

                  protected function execute(InputInterface $input, OutputInterface $output): int
                  {
                      $noShapshot = $input->getOption('no-snapshot');
                      $context = $input->getOption('context') ?: '{}';
                      if (!str_contains($context, '{')) {
              Severity: Minor
              Found in src/Command/SyncNodeCommand.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