wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub
maintenance/SaneitizeJobs.php

Summary

Maintainability
C
1 day
Test Coverage

File SaneitizeJobs.php has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace CirrusSearch\Maintenance;

use CirrusSearch\Connection;
Severity: Minor
Found in maintenance/SaneitizeJobs.php - About 3 hrs to fix

    Method showJobDetail has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function showJobDetail() {
            $profile = $this->getSearchConfig()
                ->getProfileService()
                ->loadProfileByName( SearchProfileService::SANEITIZER, $this->profileName );
            '@phan-var array $profile';
    Severity: Major
    Found in maintenance/SaneitizeJobs.php - About 2 hrs to fix

      Method pushJobs has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function pushJobs() {
              $profile = $this->getSearchConfig()
                  ->getProfileService()
                  ->loadProfileByName( SearchProfileService::SANEITIZER, $this->profileName );
              '@phan-var array $profile';
      Severity: Minor
      Found in maintenance/SaneitizeJobs.php - About 1 hr to fix

        Method initProfile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function initProfile() {
                $res = $this->getDB( DB_REPLICA )
                    ->newSelectQueryBuilder()
                    ->select( [ 'min_id' => 'MIN(page_id)', 'max_id' => 'MAX(page_id)' ] )
                    ->table( 'page' )
        Severity: Minor
        Found in maintenance/SaneitizeJobs.php - About 1 hr to fix

          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

          There are no issues that match your filters.

          Category
          Status