wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub

Showing 691 of 718 total issues

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

    public function parseValue( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector ) {
        $matches = [];
        $retValue = [];
        // FIXME: we should probably no longer accept the empty string and simply return false
        // instead of null
Severity: Minor
Found in includes/Query/PreferRecentFeature.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 setIfDefined has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setIfDefined(
        array $sourceArray,
        $sourceKey,
        array &$destArray,
        $destKey = null,
Severity: Minor
Found in includes/Util.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 buildSimpleAllFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildSimpleAllFilter( $options, $query ) {
        $filter = new \Elastica\Query\BoolQuery();
        $filter->setMinimumShouldMatch( 1 );
        // FIXME: We can't use solely the stem field here
        // - Depending on languages it may lack stopwords,
Severity: Minor
Found in includes/Query/FullTextSimpleMatchQueryBuilder.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 cleanup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function cleanup() {
        $query = $this->rawQuery;
        $nquery = Util::stripQuestionMarks( $query, $this->questionMarkStripLevel );
        if ( $nquery !== $query ) {
            $this->queryCleanups[ParsedQuery::CLEANUP_QMARK_STRIPPING] = true;
Severity: Minor
Found in includes/Parser/QueryStringRegex/QueryStringRegexParser.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 isEmpty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function isEmpty( $v ) {
        return ( is_array( $v ) && count( $v ) === 0 ) ||
            ( is_object( $v ) && count( (array)$v ) === 0 ) ||
            ( is_string( $v ) && strlen( $v ) === 0 ) ||
            ( $v === null );
Severity: Minor
Found in includes/Util.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 buildRegexWithPlugin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildRegexWithPlugin( $pattern, $insensitive ) {
        $filters = [];
        // TODO: Update plugin to accept multiple values for the field property
        // so that at index time we can create a single trigram index with
        // copy_to instead of creating multiple queries.
Severity: Minor
Found in includes/Query/BaseRegexFeature.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 replacePartsOfQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function replacePartsOfQuery( $queryPart, $regex, $callable ) {
        $destination = [];
        $matches = [];
        $offset = 0;
        while ( preg_match( $regex, $queryPart, $matches, PREG_OFFSET_CAPTURE, $offset ) ) {
Severity: Minor
Found in includes/Query/FullTextQueryStringQueryBuilder.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 toArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function toArray() {
        $ar = [
            'query' => $this->query,
            'rawQuery' => $this->rawQuery
        ];
Severity: Minor
Found in includes/Parser/AST/ParsedQuery.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 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 decidePage has a Cognitive Complexity of 6 (exceeds 5 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 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

Severity
Category
Status
Source
Language