wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub

Showing 718 of 718 total issues

Function overrideNumeric has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function overrideNumeric( &$dest, $request, $name, $limit = null, $upperLimit = true ) {
        $val = $request->getVal( $name );
        if ( $val !== null && is_numeric( $val ) ) {
            if ( $limit === null ) {
                $dest = $val;
Severity: Minor
Found in includes/Util.php - About 35 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 nextToken has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function nextToken() {
        Assert::precondition( $this->token->getStart() < $this->offset,
            'You should not call nextToken() twice on the same offsets' );
        $this->token->copyTo( $this->lookBehind );
        $this->token->reset();
Severity: Minor
Found in includes/Parser/QueryStringRegex/QueryStringRegexParser.php - About 35 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 visitBooleanClause has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitBooleanClause( BooleanClause $clause ) {
        if ( $clause->isExplicit() ) {
            $this->isComplex = true;
        }
        $oldNegated = $this->inNegation;
Severity: Minor
Found in includes/Parser/AST/Visitor/QueryFixer.php - About 35 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 classify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function classify( ParsedQuery $query ) {
        $this->hasWords = false;
        $this->hasSimplePhrase = false;
        $this->hasComplex = false;
        $this->depth = 0;
Severity: Minor
Found in includes/Parser/BasicQueryClassifier.php - About 35 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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        global $wgLanguageCode,
            $wgCirrusSearchBannedPlugins,
            $wgCirrusSearchMasterTimeout;

Severity: Minor
Found in maintenance/UpdateSuggesterIndex.php - About 35 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 build_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def build_config(parallelism: int) -> Sequence[ClusterToCheck]:
    with ThreadPoolExecutor(max_workers=parallelism) as executor:
        wiki_state = list(make_all_wiki_state(executor))

    accept_all = [
Severity: Minor
Found in scripts/check_indices.py - About 35 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 wrapDecodeResults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function wrapDecodeResults( BatchRowIterator $it, $endingAtColumn ) {
        return new CallbackIterator( $it, function ( $batch ) use ( $endingAtColumn ) {
            // Build the updater outside the loop because it stores the redirects it hits.
            // Don't build it at the top level so those are stored when it is freed.
            $updater = $this->createUpdater();
Severity: Minor
Found in maintenance/ForceSearchIndex.php - About 35 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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $this->validateParams();
        foreach ( $this->getPageIdentities() as $pageIdentity ) {
            $tagPrefix = $this->getOption( 'tagType' );
            $cirrusSearch = new CirrusSearch();
Severity: Minor
Found in maintenance/UpdateWeightedTags.php - About 35 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 getJobInfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getJobInfo( $jobName ) {
        $latest = null;
        // Fetch the lastest jobInfo from the metastore. Ideally all
        // jobInfo should be the same but in the case a cluster has
        // been decommissioned and re-added its job info may be outdated
Severity: Minor
Found in maintenance/SaneitizeJobs.php - About 35 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 validate_clusters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def validate_clusters(clusters: Sequence[ClusterToCheck]) -> Sequence[Problem]:
    clusters = list(clusters)
    es_states = {
        cluster.key: make_elasticsearch_state(cluster)
        for cluster in clusters}
Severity: Minor
Found in scripts/check_indices.py - About 35 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 listen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def listen(wiki, q):
    while True:
        try:
            error = q.get()
            if error is None:
Severity: Minor
Found in scripts/compare-clusters.py - About 35 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 buildChunks has a Cognitive Complexity of 7 (exceeds 5 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 35 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, 'Regex syntax error:  ' . $syntaxError ];
Severity: Major
Found in includes/ElasticaErrorHandler.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                        return [ null, $redirects ];
    Severity: Major
    Found in includes/Updater.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return true;
      Severity: Major
      Found in includes/Job/CheckerJob.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return [ $pageId, $hasRedirects ];
        Severity: Major
        Found in includes/Api/ApiTrait.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return (string)( $d->getId() );
          Severity: Major
          Found in includes/DataSender.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return true;
            Severity: Major
            Found in includes/Job/CheckerJob.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $requestEvent;
              Severity: Major
              Found in includes/RequestLogger.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return true;
                Severity: Major
                Found in includes/Job/CheckerJob.php - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language