wikimedia/mediawiki-core

View on GitHub
includes/actions/pagers/HistoryPager.php

Summary

Maintainability
D
3 days
Test Coverage

File HistoryPager.php has 467 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Page history pager
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Minor
Found in includes/actions/pagers/HistoryPager.php - About 7 hrs to fix

    Method formatRow has 132 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function formatRow( $row ) {
            $resultOffset = $this->getResultOffset();
            $numRows = min( $this->mResult->numRows(), $this->mLimit );
    
            $firstInList = $resultOffset === ( $this->mIsBackwards ? $numRows - 1 : 0 );
    Severity: Major
    Found in includes/actions/pagers/HistoryPager.php - About 5 hrs to fix

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

          public function formatRow( $row ) {
              $resultOffset = $this->getResultOffset();
              $numRows = min( $this->mResult->numRows(), $this->mLimit );
      
              $firstInList = $resultOffset === ( $this->mIsBackwards ? $numRows - 1 : 0 );
      Severity: Minor
      Found in includes/actions/pagers/HistoryPager.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 getStartBody has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getStartBody() {
              $this->oldIdChecked = 0;
              $s = '';
              // Button container stored in $this->buttons for re-use in getEndBody()
              $this->buttons = '';
      Severity: Minor
      Found in includes/actions/pagers/HistoryPager.php - About 1 hr to fix

        Method __construct has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                HistoryAction $historyPage,
                $year = 0,
                $month = 0,
                $day = 0,
                $tagFilter = '',
        Severity: Major
        Found in includes/actions/pagers/HistoryPager.php - About 1 hr to fix

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

              private function diffButtons( RevisionRecord $rev, $firstInList ) {
                  if ( $this->getNumRows() > 1 ) {
                      $id = $rev->getId();
                      $radio = [ 'type' => 'radio', 'value' => $id ];
                      /** @todo Move title texts to javascript */
          Severity: Minor
          Found in includes/actions/pagers/HistoryPager.php - About 1 hr to fix

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

                protected function doBatchLookups() {
                    if ( !$this->hookRunner->onPageHistoryPager__doBatchLookups( $this, $this->mResult ) ) {
                        return;
                    }
            
            
            Severity: Minor
            Found in includes/actions/pagers/HistoryPager.php - About 1 hr to fix

              Function getStartBody has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getStartBody() {
                      $this->oldIdChecked = 0;
                      $s = '';
                      // Button container stored in $this->buttons for re-use in getEndBody()
                      $this->buttons = '';
              Severity: Minor
              Found in includes/actions/pagers/HistoryPager.php - About 1 hr 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 diffButtons has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function diffButtons( RevisionRecord $rev, $firstInList ) {
                      if ( $this->getNumRows() > 1 ) {
                          $id = $rev->getId();
                          $radio = [ 'type' => 'radio', 'value' => $id ];
                          /** @todo Move title texts to javascript */
              Severity: Minor
              Found in includes/actions/pagers/HistoryPager.php - About 1 hr 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 doBatchLookups has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function doBatchLookups() {
                      if ( !$this->hookRunner->onPageHistoryPager__doBatchLookups( $this, $this->mResult ) ) {
                          return;
                      }
              
              
              Severity: Minor
              Found in includes/actions/pagers/HistoryPager.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