wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub

Showing 691 of 718 total issues

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

                TitleHelper $titleHelper,
                FetchPhaseConfigBuilder $builder,
                ElasticaResultSet $results,
                $searchContainedSyntax,
                array $extraFieldsToExtract,
Severity: Minor
Found in includes/Search/FullTextResultsType.php - About 45 mins to fix

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

        private function resolveRedirectHighlight( \Elastica\Result $r, $redirectTitleString, array $docRedirects, $namespaces ) {
            // The match was against a redirect so we should replace the $title with one that
            // represents the redirect.
            // The first step is to strip the actual highlighting from the title.
            $redirectTitleString = str_replace( [ Searcher::HIGHLIGHT_PRE, Searcher::HIGHLIGHT_POST ],
    Severity: Minor
    Found in includes/Search/FancyTitleResultsType.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 buildSettings has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $maxShardsPerNode,
            $shardCount,
            $replicaCount,
            $refreshInterval,
            array $mergeSettings,
    Severity: Minor
    Found in includes/Maintenance/IndexCreator.php - About 45 mins to fix

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

              $profileName, $pushJobFreq, $chunkSize, $minLoopDuration, $logger = null, \JobQueueGroup $jobQueueGroup = null
      Severity: Minor
      Found in includes/Maintenance/SaneitizeLoop.php - About 45 mins to fix

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

                $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector
        Severity: Minor
        Found in includes/Query/PageIdFeature.php - About 45 mins to fix

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

              protected function extractHits( array $responseData ) {
                  $hits = [];
                  if ( isset( $responseData['hits']['hits'] ) ) {
                      foreach ( $responseData['hits']['hits'] as $hit ) {
                          if ( !isset( $hit['_source']['namespace'] )
          Severity: Minor
          Found in includes/SearchRequestLog.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 defaults has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function defaults( $language ) {
                  $defaults = [
                      'analyzer' => [
                          'text' => [
                              'type' => $this->getDefaultTextAnalyzerType( $language ),
          Severity: Minor
          Found in includes/Maintenance/AnalysisConfigBuilder.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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function __construct( Client $client, $aliasName, $specificIndexName, $startOver, $type, Printer $out = null ) {
          Severity: Minor
          Found in includes/Maintenance/Validators/IndexAllAliasValidator.php - About 45 mins to fix

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

                public function parseValue( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector ) {
            Severity: Minor
            Found in includes/Query/FileTypeFeature.php - About 45 mins to fix

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

                      Index $index,
                      ConfigUtils $utils,
                      array $analysisConfig,
                      array $mappings,
                      array $similarityConfig = null,
              Severity: Minor
              Found in includes/Maintenance/IndexCreator.php - About 45 mins to fix

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

                        Index $index,
                        $masterTimeout,
                        $optimizeIndexForExperimentalHighlighter,
                        array $availablePlugins,
                        array $mappingConfig,
                Severity: Minor
                Found in includes/Maintenance/Validators/MappingValidator.php - About 45 mins to fix

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

                      public function isIndexLive( $indexName ): Status {
                          try {
                              // primary check, verify no aliases point at our index. This invokes
                              // the endpoint directly, rather than Index::getAliases, as that method
                              // does not check http status codes and can incorrectly report no aliases.
                  Severity: Minor
                  Found in includes/Maintenance/ConfigUtils.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 onBeforeInitialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function onBeforeInitialize( $title, $unused, $outputPage, $user, $request, $mediaWiki ) {
                  Severity: Minor
                  Found in includes/Hooks.php - About 45 mins to fix

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

                        private function checkAllMatches( $transformer, $transformedTerm, $allMatchedTitles ) {
                            if ( isset( $allMatchedTitles[ 'titleMatch' ] ) &&
                                    $this->checkOneMatch( $transformer, $transformedTerm, $allMatchedTitles[ 'titleMatch' ] ) ) {
                                return $allMatchedTitles[ 'titleMatch' ];
                            }
                    Severity: Minor
                    Found in includes/NearMatchPicker.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 parseValue has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function parseValue( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector ) {
                    Severity: Minor
                    Found in includes/Query/IndexedNumericFieldFeature.php - About 45 mins to fix

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

                          public function parseValue( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector );
                      Severity: Minor
                      Found in includes/Query/KeywordFeature.php - About 45 mins to fix

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

                            public function parseValue( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector ) {
                        Severity: Minor
                        Found in includes/Query/PrefixFeature.php - About 45 mins to fix

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

                              public static function looksLikeAutomation( SearchConfig $config, string $ip, array $headers ): bool {
                                  // Is there an http header that can be matched with regex to flag automation,
                                  // such as the user-agent or a flag applied by some infrastructure?
                                  $automationHeaders = $config->get( 'CirrusSearchAutomationHeaderRegexes' ) ?? [];
                                  foreach ( $automationHeaders as $name => $pattern ) {
                          Severity: Minor
                          Found in includes/Util.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 buildSuggestion has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              private function buildSuggestion( $suggestionType, $docId, array $inputs, $score, array $inputDoc, array $scoreExplanation = null ) {
                          Severity: Minor
                          Found in includes/BuildDocument/Completion/SuggestBuilder.php - About 45 mins to fix

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

                                public function parseValue( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector ) {
                            Severity: Minor
                            Found in includes/Query/HasTemplateFeature.php - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language