wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub

Showing 691 of 718 total issues

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

        \CirrusSearch\Parser\KeywordRegistry $keywordRegistry,
        Escaper $escaper,
        $qmarkStripLevel,
        ParsedQueryClassifiersRepository $classifierRepository,
        NamespacePrefixParser $namespacePrefixParser,
Severity: Minor
Found in includes/Parser/QueryStringRegex/QueryStringRegexParser.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/BoostTemplatesFeature.php - About 45 mins to fix

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

          public function getFixablePart() {
              if ( !$this->visited ) {
                  $this->visited = true;
                  $this->parsedQuery->getRoot()->accept( $this );
              }
      Severity: Minor
      Found in includes/Parser/AST/Visitor/QueryFixer.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 extractDisplayTitle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function extractDisplayTitle( Title $title, ParserOutput $output ): ?string {
              $titleText = $title->getText();
              $titlePrefixedText = $title->getPrefixedText();
      
              $raw = $output->getDisplayTitle();
      Severity: Minor
      Found in includes/BuildDocument/ParserOutputPageProperties.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/BaseRegexFeature.php - About 45 mins to fix

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

                $key,
                $value,
                $quotedValue,
                $valueDelimiter,
                $suffix,
        Severity: Minor
        Found in includes/Query/SimpleKeywordFeature.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/PreferRecentFeature.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/LanguageFeature.php - About 45 mins to fix

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

                  public function parseValue( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector ) {
                      // en:Programming|id:3041512\
                      $categories = explode( '|', $value );// en:programming
                      if ( count( $categories ) > $this->maxConditions ) {
                          $warningCollector->addWarning(
              Severity: Minor
              Found in includes/Query/InCategoryFeature.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 setIfDefined has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      array $sourceArray,
                      $sourceKey,
                      array &$destArray,
                      $destKey = null,
                      $mapFn = null,
              Severity: Minor
              Found in includes/Util.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/InCategoryFeature.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/SubPageOfFeature.php - About 45 mins to fix

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

                        public static function processSearchRawReturn( $result, WebRequest $request,
                                                                       CirrusDebugOptions $debugOptions ) {
                            $output = null;
                            $header = null;
                            if ( $debugOptions->getCirrusExplainFormat() !== null ) {
                    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

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

                        public function finishInitializeBatch(): void {
                            if ( !$this->linkCountClosures ) {
                                return;
                            }
                            $linkCountClosureCount = count( $this->linkCountClosures );
                    Severity: Minor
                    Found in includes/BuildDocument/RedirectsAndIncomingLinks.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

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

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

                          public function doApplyExtended( SearchContext $context, $key, $value, $quotedValue, $negated, $delimiter, $suffix ) {
                              $parsedValue = $this->parseValue( $key, $value, $quotedValue, $delimiter, $suffix, $context );
                              if ( $this->isRegexQuery( $parsedValue ) ) {
                                  if ( !$this->enabled ) {
                                      return [ null, false ];
                      Severity: Minor
                      Found in includes/Query/BaseRegexFeature.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/HasRecommendationFeature.php - About 45 mins to fix

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

                            public function getInterwikiResults( SearchQuery $query ): Status {
                                $sources = MediaWikiServices::getInstance()
                                    ->getService( InterwikiResolver::SERVICE )
                                    ->getSisterProjectConfigs();
                                if ( !$sources ) {
                        Severity: Minor
                        Found in includes/InterwikiSearcher.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 accept has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def accept(self, cluster_state: ElasticsearchState) -> Sequence[str]:
                                # metastore should exist on all cirrussearch clusters
                                try:
                                    yield cluster_state.aliases['mw_cirrus_metastore']
                                except KeyError:
                        Severity: Minor
                        Found in scripts/check_indices.py - 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 check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function check( $name, $expected, $actual ) {
                                $this->output( str_repeat( "\t", count( $this->path ) ) );
                                $this->output( "$name..." );
                                if ( is_array( $expected ) ) {
                                    if ( in_array( $actual, $expected ) ) {
                        Severity: Minor
                        Found in maintenance/CheckIndexes.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

                        Severity
                        Category
                        Status
                        Source
                        Language