wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub
maintenance/RunSearch.php

Summary

Maintainability
B
6 hrs
Test Coverage

Method searchFor has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function searchFor( $query ) {
        $searchType = $this->getOption( 'type', 'full_text' );

        if ( $searchType === 'archive' ) {
            // Archive has its own engine so go directly there
Severity: Minor
Found in maintenance/RunSearch.php - About 1 hr to fix

    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

      Function applyGlobals has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function applyGlobals() {
              $optionsData = $this->getOption( 'options', 'false' );
              if ( substr_compare( $optionsData, 'B64://', 0, strlen( 'B64://' ) ) === 0 ) {
                  $optionsData = base64_decode( substr( $optionsData, strlen( 'B64://' ) ) );
              }
      Severity: Minor
      Found in maintenance/RunSearch.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 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

      Avoid too many return statements within this method.
      Open

                          return Status::newGood( $result );
      Severity: Major
      Found in maintenance/RunSearch.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return $result;
        Severity: Major
        Found in maintenance/RunSearch.php - About 30 mins to fix

          Function searchFor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function searchFor( $query ) {
                  $searchType = $this->getOption( 'type', 'full_text' );
          
                  if ( $searchType === 'archive' ) {
                      // Archive has its own engine so go directly there
          Severity: Minor
          Found in maintenance/RunSearch.php - About 25 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 processResultSet has a Cognitive Complexity of 6 (exceeds 5 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 25 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

          There are no issues that match your filters.

          Category
          Status