wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub

Showing 718 of 718 total issues

Method processResultSet has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function processResultSet( CirrusSearchResultSet $value, $query ) {
        // these are prefix or full text results
        $rows = [];
        foreach ( $value as $result ) {
            /** @var CirrusSearch\Search\CirrusSearchResult $result */
Severity: Minor
Found in maintenance/RunSearch.php - About 1 hr to fix

    Method getRequests has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getRequests() {
            if ( !$this->request || !$this->response ) {
                // we don't actually know at this point how many searches there were,
                // or how many results to return...so just bail and return nothing
                return [];
    Severity: Minor
    Found in includes/MultiSearchRequestLog.php - About 1 hr to fix

      Method updateLinkedArticles has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateLinkedArticles( $titles ): void {
              $pages = [];
              $wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
              foreach ( $titles as $title ) {
                  // Special pages don't get updated, we only index
      Severity: Minor
      Found in includes/Updater.php - About 1 hr to fix

        Method makeRemoteReindexInfo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function makeRemoteReindexInfo( Connection $source, Connection $dest ) {
                if ( $source->getClusterName() === $dest->getClusterName() ) {
                    return null;
                }
        
        
        Severity: Minor
        Found in includes/Maintenance/Reindexer.php - About 1 hr to fix

          Method handleSearchGetNearMatch has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function handleSearchGetNearMatch( $term, &$titleResult ) {
                  global $wgSearchType;
                  if ( $wgSearchType !== 'CirrusSearch' ) {
                      return true;
                  }
          Severity: Minor
          Found in includes/Hooks.php - About 1 hr to fix

            Method initializeForRequest has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function initializeForRequest( WebRequest $request ) {
                    global $wgCirrusSearchPhraseRescoreWindowSize,
                        $wgCirrusSearchFunctionRescoreWindowSize,
                        $wgCirrusSearchFragmentSize,
                        $wgCirrusSearchPhraseRescoreBoost,
            Severity: Minor
            Found in includes/Hooks.php - About 1 hr to fix

              Method fix has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function fix( $replacement ) {
                      Assert::precondition( $this->visited, "getFixablePart must be called before trying to fix the query" );
                      if ( $this->node === null ) {
                          return null;
                      }
              Severity: Minor
              Found in includes/Parser/AST/Visitor/QueryFixer.php - About 1 hr to fix

                Method decidePage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function decidePage( Updater $updater, WikiPage $page ) {
                        try {
                            $content = $page->getContent();
                        } catch ( Throwable $ex ) {
                            LoggerFactory::getInstance( 'CirrusSearch' )->warning(
                Severity: Minor
                Found in maintenance/ForceSearchIndex.php - About 1 hr to fix

                  Method buildChunks has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function buildChunks( $buildChunks ) {
                          $dbr = $this->getDB( DB_REPLICA, [ 'vslow' ] );
                          if ( $this->toId === null ) {
                              $this->toId = $dbr->newSelectQueryBuilder()
                                  ->select( 'MAX(page_id)' )
                  Severity: Minor
                  Found in maintenance/ForceSearchIndex.php - About 1 hr to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        'popular_inclinks' => [
                            'supported_namespaces' => 'all',
                            'i18n_msg' => 'cirrussearch-qi-profile-popular-inclinks',
                            'rescore' => [
                                $phraseRescorePlaceHolder,
                    Severity: Major
                    Found in profiles/RescoreProfiles.config.php and 1 other location - About 1 hr to fix
                    profiles/RescoreProfiles.config.php on lines 119..143

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 103.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                                'fields' => [
                                    'title' => 0.3,
                                    'redirect.title' => [
                                        'boost' => 0.27,
                                        'in_dismax' => 'redirects_or_shingles'
                    Severity: Major
                    Found in profiles/FullTextQueryBuilderProfiles.config.php and 2 other locations - About 1 hr to fix
                    profiles/FullTextQueryBuilderProfiles.config.php on lines 43..75
                    profiles/FullTextQueryBuilderProfiles.config.php on lines 103..126

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 103.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                                'fields' => [
                                    'title' => 0.3,
                                    'redirect.title' => [
                                        'boost' => 0.27,
                                        'in_dismax' => 'redirects_or_shingles'
                    Severity: Major
                    Found in profiles/FullTextQueryBuilderProfiles.config.php and 2 other locations - About 1 hr to fix
                    profiles/FullTextQueryBuilderProfiles.config.php on lines 43..75
                    profiles/FullTextQueryBuilderProfiles.config.php on lines 154..177

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 103.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                                'fields' => [
                                    // very high title weight for features/create_new_page.feature:23
                                    // Make sure that Catapult wins Catapult/adsf despite not having
                                    // Catapult in the content
                                    'title' => 2.3,
                    Severity: Major
                    Found in profiles/FullTextQueryBuilderProfiles.config.php and 2 other locations - About 1 hr to fix
                    profiles/FullTextQueryBuilderProfiles.config.php on lines 103..126
                    profiles/FullTextQueryBuilderProfiles.config.php on lines 154..177

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 103.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        'wsum_inclinks' => [
                            'i18n_msg' => 'cirrussearch-qi-profile-wsum-inclinks',
                            'supported_namespaces' => 'all',
                            'rescore' => [
                                $phraseRescorePlaceHolder,
                    Severity: Major
                    Found in profiles/RescoreProfiles.config.php and 1 other location - About 1 hr to fix
                    profiles/RescoreProfiles.config.php on lines 204..228

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 103.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                            SearchConfig $config,
                            Connection $connection,
                            Remediator $remediator,
                            Searcher $searcher,
                            StatsFactory $statsFactory,
                    Severity: Major
                    Found in includes/Sanity/Checker.php - About 1 hr to fix

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

                          public function __construct( Connection $conn, $limit, $offset = 0, SearchConfig $config = null, array $namespaces = null,
                              User $user = null, $index = false, $profileName = null,
                                                       CirrusDebugOptions $debugOptions = null ) {
                      Severity: Major
                      Found in includes/CompletionSuggester.php - About 1 hr to fix

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

                                Client $client,
                                $aliasName,
                                $specificIndexName,
                                $startOver,
                                Reindexer $reindexer,
                        Severity: Major
                        Found in includes/Maintenance/Validators/SpecificAliasValidator.php - About 1 hr to fix

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

                                  $startOffset,
                                  $endOffset,
                                  KeywordFeature $keyword,
                                  $key,
                                  $value,
                          Severity: Major
                          Found in includes/Parser/AST/KeywordFeatureNode.php - About 1 hr to fix

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

                                    Connection $connection,
                                    SearchConfig $config,
                                    array $namespaces = null,
                                    User $user = null,
                                    CirrusDebugOptions $debugOptions = null,
                            Severity: Major
                            Found in includes/InterwikiSearcher.php - About 1 hr to fix

                              Method getStatus has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function getStatus() {
                                      if ( $this->response ) {
                                          // task complete
                                          return $this->response;
                                      }
                              Severity: Minor
                              Found in includes/Elastica/ReindexTask.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language