wikimedia/mediawiki-core

View on GitHub
includes/specials/pagers/ContribsPager.php

Summary

Maintainability
F
4 days
Test Coverage

File ContribsPager.php has 572 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
Severity: Major
Found in includes/specials/pagers/ContribsPager.php - About 1 day to fix

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

        public function formatRow( $row ) {
            $ret = '';
            $classes = [];
            $attribs = [];
    
    
    Severity: Major
    Found in includes/specials/pagers/ContribsPager.php - About 6 hrs to fix

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

          public function formatRow( $row ) {
              $ret = '';
              $classes = [];
              $attribs = [];
      
      
      Severity: Minor
      Found in includes/specials/pagers/ContribsPager.php - About 4 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

      ContribsPager has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ContribsPager extends RangeChronologicalPager {
      
          public $mGroupByDate = true;
      
          /**
      Severity: Minor
      Found in includes/specials/pagers/ContribsPager.php - About 2 hrs to fix

        Method getQueryInfo has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getQueryInfo() {
                $revQuery = $this->revisionStore->getQueryInfo( [ 'page', 'user' ] );
                $queryInfo = [
                    'tables' => $revQuery['tables'],
                    'fields' => array_merge( $revQuery['fields'], [ 'page_is_new' ] ),
        Severity: Major
        Found in includes/specials/pagers/ContribsPager.php - About 2 hrs to fix

          Method __construct has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __construct(
                  IContextSource $context,
                  array $options,
                  LinkRenderer $linkRenderer = null,
                  LinkBatchFactory $linkBatchFactory = null,
          Severity: Major
          Found in includes/specials/pagers/ContribsPager.php - About 2 hrs to fix

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

                public function reallyDoQuery( $offset, $limit, $order ) {
                    [ $tables, $fields, $conds, $fname, $options, $join_conds ] = $this->buildQueryInfo(
                        $offset,
                        $limit,
                        $order
            Severity: Minor
            Found in includes/specials/pagers/ContribsPager.php - About 1 hr to fix

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

                  protected function doBatchLookups() {
                      # Do a link batch query
                      $this->mResult->seek( 0 );
                      $parentRevIds = [];
                      $this->mParentLens = [];
              Severity: Minor
              Found in includes/specials/pagers/ContribsPager.php - About 1 hr to fix

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

                        IContextSource $context,
                        array $options,
                        LinkRenderer $linkRenderer = null,
                        LinkBatchFactory $linkBatchFactory = null,
                        HookContainer $hookContainer = null,
                Severity: Major
                Found in includes/specials/pagers/ContribsPager.php - About 1 hr to fix

                  Function __construct has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function __construct(
                          IContextSource $context,
                          array $options,
                          LinkRenderer $linkRenderer = null,
                          LinkBatchFactory $linkBatchFactory = null,
                  Severity: Minor
                  Found in includes/specials/pagers/ContribsPager.php - About 55 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 getQueryInfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getQueryInfo() {
                          $revQuery = $this->revisionStore->getQueryInfo( [ 'page', 'user' ] );
                          $queryInfo = [
                              'tables' => $revQuery['tables'],
                              'fields' => array_merge( $revQuery['fields'], [ 'page_is_new' ] ),
                  Severity: Minor
                  Found in includes/specials/pagers/ContribsPager.php - About 55 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 doBatchLookups has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function doBatchLookups() {
                          # Do a link batch query
                          $this->mResult->seek( 0 );
                          $parentRevIds = [];
                          $this->mParentLens = [];
                  Severity: Minor
                  Found in includes/specials/pagers/ContribsPager.php - About 55 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 reallyDoQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function reallyDoQuery( $offset, $limit, $order ) {
                          [ $tables, $fields, $conds, $fname, $options, $join_conds ] = $this->buildQueryInfo(
                              $offset,
                              $limit,
                              $order
                  Severity: Minor
                  Found in includes/specials/pagers/ContribsPager.php - About 25 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