wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub

Showing 691 of 718 total issues

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

    private function waitForQueueToDrain( $wiki ) {
        if ( !$this->queue ) {
            return;
        }

Severity: Minor
Found in maintenance/ForceSearchIndex.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 consume has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function consume( $query ) {
        if ( $this->getOption( 'decode' ) ) {
            $query = urldecode( $query );
        }
        $data = [ 'query' => $query ];
Severity: Minor
Found in maintenance/RunSearch.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

Consider simplifying this complex logical expression.
Open

        if ( !array_key_exists( $analyzer, $config['analyzer'] ) // array exists
            || $config['analyzer'][$analyzer]['type'] != 'custom' // array is custom
            || !$this->requiredTokenizerUsed( $config['analyzer'][$analyzer] )
            || $this->disallowedTokenFiltersPresent( $config, $analyzer )
            || $this->disallowedCharFiltersPresent( $config, $analyzer )
Severity: Major
Found in includes/Maintenance/GlobalCustomFilter.php - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

            if ( !$this->indexUpdates || $this->hasOption( 'limit' )
                || $this->hasOption( 'from' ) || $this->hasOption( 'to' )
                || $this->hasOption( 'fromId' ) || $this->hasOption( 'toId' )
            ) {
                $this->fatalError(
    Severity: Major
    Found in maintenance/ForceSearchIndex.php - About 40 mins to fix

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

              SearchConfig $config,
              WANObjectCache $wanCache,
              InterwikiLookup $iwLookup,
              ExtensionRegistry $extensionRegistry,
              MultiHttpClient $client
      Severity: Minor
      Found in includes/InterwikiResolverFactory.php - About 35 mins to fix

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

            public function onPageDelete( ProperPageIdentity $page,
                Authority $deleter,
                string $reason,
                StatusValue $status,
                bool $suppress
        Severity: Minor
        Found in includes/PageChangeTracker.php - About 35 mins to fix

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

                  $searchEngineEntryPoint,
                  array $namespaces,
                  array $acceptableQueryClasses,
                  $profileContext,
                  $score
          Severity: Minor
          Found in includes/Dispatch/BasicSearchQueryRoute.php - About 35 mins to fix

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

                    string $indexSuffix,
                    array $docIds,
                    string $tagField,
                    string $tagPrefix,
                    int $batchSize = 30
            Severity: Minor
            Found in includes/DataSender.php - About 35 mins to fix

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

                  public function __construct( SearchConfig $config = null,
                      CirrusDebugOptions $debugOptions = null,
                      NamespacePrefixParser $namespacePrefixParser = null,
                      InterwikiResolver $interwikiResolver = null, TitleHelper $titleHelper = null
              Severity: Minor
              Found in includes/CirrusSearch.php - About 35 mins to fix

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

                        ProperPageIdentity $page,
                        Authority $deleter,
                        string $reason,
                        \StatusValue $status,
                        bool $suppress
                Severity: Minor
                Found in includes/ChangeListener.php - About 35 mins to fix

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

                      public function onTitleMove( Title $old, Title $nt, User $user, $reason, Status &$status ) {
                  Severity: Minor
                  Found in includes/ChangeListener.php - About 35 mins to fix

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

                        public static function fromConfig( $type, $name, $configEntry, Config $config, BagOStuff $cache ) {
                    Severity: Minor
                    Found in includes/Profile/PhraseSuggesterProfileRepoWrapper.php - About 35 mins to fix

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

                              SearcherFactory $factory,
                              CirrusSearchResultSet $initialResult,
                              MSearchResponses $responses,
                              NamespacePrefixParser $namespacePrefixParser,
                              CirrusSearchHookRunner $cirrusSearchHookRunner
                      Severity: Minor
                      Found in includes/Fallbacks/FallbackRunner.php - About 35 mins to fix

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

                                $name,
                                $target,
                                $pattern,
                                $caseInsensitive,
                                $priority = HighlightedField::COSTLY_EXPERT_SYNTAX_PRIORITY
                        Severity: Minor
                        Found in includes/Search/Fetch/HighlightFieldGenerator.php - About 35 mins to fix

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

                                  $name,
                                  $target,
                                  $pattern,
                                  $caseInsensitive,
                                  $priority = HighlightedField::COSTLY_EXPERT_SYNTAX_PRIORITY
                          Severity: Minor
                          Found in includes/Search/Fetch/FetchPhaseConfigBuilder.php - About 35 mins to fix

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

                                    FallbackRunnerContext $context,
                                    SearchQuery $originalQuery,
                                    string $suggestedQuery,
                                    $suggestedQuerySnippet = null,
                                    int $resultsThreshold = 1
                            Severity: Minor
                            Found in includes/Fallbacks/FallbackMethodTrait.php - About 35 mins to fix

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

                                      Config $mainConfig,
                                      TitleFormatter $titleFormatter,
                                      SearchConfig $searchConfig,
                                      GlobalIdGenerator $globalIdGenerator,
                                      StreamNameMapper $streamNameMapper
                              Severity: Minor
                              Found in includes/Event/PageRerenderSerializer.php - About 35 mins to fix

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

                                    public function __construct( SearchConfig $config, $requestedNamespaces, $localSearch, $withDefaultBoosts, $weight ) {
                                Severity: Minor
                                Found in includes/Search/Rescore/BoostTemplatesFunctionScoreBuilder.php - About 35 mins to fix

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

                                          FetchPhaseConfigBuilder $fetchPhaseBuilder,
                                          $searchContainedSyntax,
                                          TitleHelper $titleHelper,
                                          array $extraFieldsToExtract = [],
                                          bool $deduplicate = false
                                  Severity: Minor
                                  Found in includes/Search/FullTextResultsType.php - About 35 mins to fix

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

                                            $name,
                                            $target,
                                            $pattern,
                                            $caseInsensitive,
                                            $priority = HighlightedField::COSTLY_EXPERT_SYNTAX_PRIORITY
                                    Severity: Minor
                                    Found in includes/Search/Fetch/FetchPhaseConfigBuilder.php - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language