wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub

Showing 718 of 718 total issues

Method validate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function validate() {
        $this->outputIndented( "\tValidating shard allocation settings..." );

        $actual = $this->fetchActualAllocation();
        $changed = false;
Severity: Minor
Found in includes/Maintenance/Validators/ShardAllocationValidator.php - About 1 hr to fix

    Method execute has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function execute() {
            if ( $this->hasOption( 'nagios' ) ) {
                // Force silent running mode so we can match Nagios expected output.
                $this->mQuiet = true;
            }
    Severity: Minor
    Found in maintenance/CheckIndexes.php - About 1 hr to fix

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

          protected function searchTextReal( SearchQuery $query ) {
              $searcher = $this->makeSearcher( $query->getSearchConfig() );
              $status = $searcher->search( $query );
              $this->lastSearchMetrics = $searcher->getSearchMetrics();
              if ( !$status->isOK() ) {
      Severity: Minor
      Found in includes/CirrusSearch.php - About 1 hr to fix

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

            private function nextToken() {
                Assert::precondition( $this->token->getStart() < $this->offset,
                    'You should not call nextToken() twice on the same offsets' );
                $this->token->copyTo( $this->lookBehind );
                $this->token->reset();
        Severity: Minor
        Found in includes/Parser/QueryStringRegex/QueryStringRegexParser.php - About 1 hr to fix

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

              public function initialize( array $pagesOrRevs, int $flags ): array {
                  $documents = [];
                  $builders = $this->createBuilders( $flags );
                  foreach ( $pagesOrRevs as $pageOrRev ) {
                      if ( $pageOrRev instanceof RevisionRecord ) {
          Severity: Minor
          Found in includes/BuildDocument/BuildDocument.php - About 1 hr to fix

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

                public function __construct() {
                    parent::__construct();
                    $this->addDescription( "Create a new suggester index. Always operates on a single cluster." );
                    $this->addOption( 'baseName', 'What basename to use for all indexes, ' .
                        'defaults to wiki id', false, true );
            Severity: Minor
            Found in maintenance/UpdateSuggesterIndex.php - About 1 hr to fix

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

                  public function execute() {
                      // Use the default connection, rather than the one specified
                      // by --cluster, as we are collecting cluster independent metadata.
                      // Also our script specific `all` cluster fails self::getConnection.
                      $conn = Connection::getPool( $this->getSearchConfig() );
              Severity: Minor
              Found in maintenance/UpdateSearchIndexConfig.php - About 1 hr to fix

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

                    public function __construct() {
                        parent::__construct();
                        $this->addDescription( "Dump an index into a 'json' based format stdout. " .
                            "This format complies to the elasticsearch bulk format and can be directly used " .
                            "with a curl command like : " .
                Severity: Minor
                Found in maintenance/DumpIndex.php - About 1 hr to fix

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

                      private function mergeStatusWithChildren( array $status, array $childResponse ) {
                          foreach ( $childResponse['nodes'] as $nodeData ) {
                              foreach ( $nodeData['tasks'] as $taskId => $childData ) {
                                  $sliceId = $childData['status']['slice_id'];
                                  $status['slices'][$sliceId] = $childData['status'];
                  Severity: Minor
                  Found in includes/Elastica/ReindexTask.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 reportUpdateMetrics has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function reportUpdateMetrics(
                          \Elastica\Bulk\ResponseSet $responseSet, $indexSuffix, $sent
                      ) {
                          $updateStats = [
                              'sent' => $sent,
                  Severity: Minor
                  Found in includes/DataSender.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 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function execute() {
                          $service = $this->service;
                          $verbose = $this->getParameter( 'verbose' );
                          $contexts = [];
                          foreach ( $service->listProfileTypes() as $type ) {
                  Severity: Minor
                  Found in includes/Api/ProfilesDump.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 sendBatch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function sendBatch() {
                          $allSame = true;
                          $firstRemediator = null;
                          foreach ( $this->perClusterBufferedRemediator as $remediator ) {
                              if ( $firstRemediator === null ) {
                  Severity: Minor
                  Found in includes/Sanity/MultiClusterRemediatorHelper.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 bestRoute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function bestRoute( SearchQuery $query ): SearchQueryRoute {
                          Assert::parameter( isset( $this->routes[$query->getSearchEngineEntryPoint()] ), 'query',
                              "Unsupported search engine entry point {$query->getSearchEngineEntryPoint()}" );
                  
                          $routes = $this->routes[$query->getSearchEngineEntryPoint()];
                  Severity: Minor
                  Found in includes/Dispatch/DefaultSearchQueryDispatchService.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 getImplementation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getImplementation( $func ) {
                          $weight = $func['weight'] ?? 1;
                          $config = $this->context->getConfig();
                          switch ( $func['type'] ) {
                              case 'boostlinks':
                  Severity: Minor
                  Found in includes/Search/Rescore/FunctionScoreChain.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 getMapping has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getMapping( SearchEngine $engine ) {
                          if ( !( $engine instanceof CirrusSearch ) ) {
                              throw new \LogicException( "Cannot map CirrusSearch fields for another engine." );
                          }
                          $this->initFlags();
                  Severity: Minor
                  Found in includes/Search/TextIndexField.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 findUsedFromField has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function findUsedFromField( array $properties ) {
                          $analyzers = new Set();
                          foreach ( $properties as $name => $config ) {
                              foreach ( self::$ANALYZER_FIELDS as $key ) {
                                  if ( isset( $config[$key] ) ) {
                  Severity: Minor
                  Found in includes/Maintenance/AnalysisFilter.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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function __construct(
                          $langCode,
                          array $plugins,
                          SearchConfig $config = null,
                          CirrusSearchHookRunner $cirrusSearchHookRunner = null
                  Severity: Minor
                  Found in includes/Maintenance/AnalysisConfigBuilder.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 build has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function build( $self, array $options, $buildChunks, $fromPageId, $toPageId ) {
                          $fixedChunkSize = strpos( $buildChunks, 'total' ) === false;
                          $buildChunks = intval( $buildChunks );
                          if ( $fixedChunkSize ) {
                              $chunkSize = $buildChunks;
                  Severity: Minor
                  Found in includes/Maintenance/ChunkBuilder.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 initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function initialize( array $pagesOrRevs, int $flags ): array {
                          $documents = [];
                          $builders = $this->createBuilders( $flags );
                          foreach ( $pagesOrRevs as $pageOrRev ) {
                              if ( $pageOrRev instanceof RevisionRecord ) {
                  Severity: Minor
                  Found in includes/BuildDocument/BuildDocument.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 find_candidates has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def find_candidates(start: datetime, end: datetime, batch_size: int = 10):
                      if end > start:
                          # works backwards, so the end time must come before the start time
                          start, end = end, start
                  
                  
                  Severity: Minor
                  Found in scripts/check_rc.py - 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

                  Severity
                  Category
                  Status
                  Source
                  Language