Headoo/ElasticSearchBundle

View on GitHub

Showing 16 of 16 total issues

Method processBatch has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function processBatch($type, $transformer)
    {
        $this->output->writeln(self::completeLine("Creating Type {$type} and Mapping"));

        $objectType = $this->getIndexFromType($type)->getType($type);
Severity: Minor
Found in Command/PopulateElasticCommand.php - About 1 hr to fix

    Function removeFromElasticSearch has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        private function removeFromElasticSearch($type, $repository, $resultSet)
        {
            foreach ($resultSet as $result) {
                $this->nbrDocumentTested++;
                $documentId = $result->getDocument()->getId();
    Severity: Minor
    Found in Command/ExodusElasticCommand.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 12 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $this->init($input, $output);
    
            if ($input->getOption('where') && ! $input->getOption('id')) {
    Severity: Minor
    Found in Command/PopulateElasticCommand.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 runParallel has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function runParallel(ProgressBar $progressBar, array $processes, $maxParallel, $poll = 1000, $numberOfEntities)
        {
            // do not modify the object pointers in the argument, copy to local working variable
            $processesQueue = $processes;
            // fix maxParallel to be max the number of processes or positive
    Severity: Minor
    Found in Command/PopulateElasticCommand.php - About 1 hr to fix

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

          protected function readOption(InputInterface $input)
          {
              $this->type   = $input->getOption('type');
              $this->batch  = $input->getOption('batch') ?: $this->batch;
      
      
      Severity: Minor
      Found in Command/AbstractCommand.php - About 1 hr to fix

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

            private function _getQuery($type, &$iResults)
            {
                $id = filter_var($this->id, FILTER_SANITIZE_STRING);
                $where = filter_var($this->where, FILTER_SANITIZE_STRING);
                $joins = filter_var($this->join, FILTER_SANITIZE_STRING);
        Severity: Minor
        Found in Command/PopulateElasticCommand.php - About 1 hr to fix

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

              public function getConfigTreeBuilder()
              {
                  $treeBuilder = new TreeBuilder();
                  $rootNode = $treeBuilder->root('headoo_elastic_search');
          
          
          Severity: Minor
          Found in DependencyInjection/Configuration.php - About 1 hr to fix

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

                public function runParallel(ProgressBar $progressBar, array $processes, $maxParallel, $poll = 1000, $numberOfEntities)
                {
                    // do not modify the object pointers in the argument, copy to local working variable
                    $processesQueue = $processes;
                    // fix maxParallel to be max the number of processes or positive
            Severity: Minor
            Found in Command/PopulateElasticCommand.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 execute has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function execute(InputInterface $input, OutputInterface $output)
                {
                    $this->init($input, $output);
            
                    if ($input->getOption('where') && ! $input->getOption('id')) {
            Severity: Minor
            Found in Command/PopulateElasticCommand.php - About 1 hr to fix

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

                  public function processBatch($type, $transformer)
                  {
                      $this->output->writeln(self::completeLine("Creating Type {$type} and Mapping"));
              
                      $objectType = $this->getIndexFromType($type)->getType($type);
              Severity: Minor
              Found in Command/PopulateElasticCommand.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 readOption has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function readOption(InputInterface $input)
                  {
                      $this->type   = $input->getOption('type');
                      $this->batch  = $input->getOption('batch') ?: $this->batch;
              
              
              Severity: Minor
              Found in Command/AbstractCommand.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 _getQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function _getQuery($type, &$iResults)
                  {
                      $id = filter_var($this->id, FILTER_SANITIZE_STRING);
                      $where = filter_var($this->where, FILTER_SANITIZE_STRING);
                      $joins = filter_var($this->join, FILTER_SANITIZE_STRING);
              Severity: Minor
              Found in Command/PopulateElasticCommand.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 getOptionsToString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getOptionsToString($excludedOption = [])
                  {
                      $aOptions = $this->input->getOptions();
                      $sOptions = '';
              
              
              Severity: Minor
              Found in Command/AbstractCommand.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 _catchEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private function _catchEvent($entity, $transformer, $connectionName, $indexName, $action)
              Severity: Minor
              Found in EventListener/ElasticSearchListener.php - About 35 mins to fix

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

                    public function runParallel(ProgressBar $progressBar, array $processes, $maxParallel, $poll = 1000, $numberOfEntities)
                Severity: Minor
                Found in Command/PopulateElasticCommand.php - About 35 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return $returnValue;
                  Severity: Major
                  Found in Command/PopulateElasticCommand.php - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language