wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub
includes/Job/CheckerJob.php

Summary

Maintainability
D
1 day
Test Coverage

Method doJob has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function doJob() {
        $profile = $this->searchConfig
            ->getProfileService()
            ->loadProfileByName( SearchProfileService::SANEITIZER, $this->params['profile'], false );

Severity: Major
Found in includes/Job/CheckerJob.php - About 5 hrs to fix

    Function doJob has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function doJob() {
            $profile = $this->searchConfig
                ->getProfileService()
                ->loadProfileByName( SearchProfileService::SANEITIZER, $this->params['profile'], false );
    
    
    Severity: Minor
    Found in includes/Job/CheckerJob.php - About 3 hrs 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

    Method retry has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function retry( $cause, $newFrom, $cluster = null ) {
            if ( $this->params['retryCount'] >= self::JOB_MAX_RETRIES ) {
                LoggerFactory::getInstance( 'CirrusSearch' )->info(
                    "Sanitize CheckerJob: $cause ({fromPageId}:{toPageId}), Abandonning CheckerJob after {retries} retries " .
                    "for {cluster}, (jobs_chunk_size too high?).",
    Severity: Minor
    Found in includes/Job/CheckerJob.php - About 1 hr to fix

      Method build has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function build( $fromPageId, $toPageId, $delay, $profile, $cluster, $loopId, \JobQueueGroup $jobQueueGroup ) {
      Severity: Major
      Found in includes/Job/CheckerJob.php - About 50 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 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 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 true;
                    Severity: Major
                    Found in includes/Job/CheckerJob.php - About 30 mins to fix

                      There are no issues that match your filters.

                      Category
                      Status