wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub

Showing 691 of 718 total issues

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

                  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 Status::newGood();
                    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 true;
                        Severity: Major
                        Found in includes/Job/CheckerJob.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return [
                                          Status::newFatal( 'cirrussearch-backend-error' ),
                                          $formattedMessage
                                      ];
                          Severity: Major
                          Found in includes/ElasticaErrorHandler.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return Status::newFatal( 'cirrussearch-failed-send-data' );
                            Severity: Major
                            Found in includes/DataSender.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return $error;
                              Severity: Major
                              Found in includes/ElasticaErrorHandler.php - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language