wikimedia/mediawiki-core

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

Summary

Maintainability
D
3 days
Test Coverage

File UsersPager.php has 405 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Copyright © 2004 Brooke Vibber, lcrocker, Tim Starling,
 * Domas Mituzas, Antoine Musso, Jens Frank, Zhengzhu,
 * 2006 Rob Church <robchur@gmail.com>
Severity: Minor
Found in includes/specials/pagers/UsersPager.php - About 5 hrs to fix

    Method getPageHeader has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getPageHeader() {
            $self = explode( '/', $this->getTitle()->getPrefixedDBkey(), 2 )[0];
    
            $groupOptions = [ $this->msg( 'group-all' )->text() => '' ];
            foreach ( $this->getAllGroups() as $group => $groupText ) {
    Severity: Major
    Found in includes/specials/pagers/UsersPager.php - About 3 hrs to fix

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

          public function getQueryInfo() {
              $dbr = $this->getDatabase();
              $conds = [];
              $options = [];
      
      
      Severity: Major
      Found in includes/specials/pagers/UsersPager.php - About 3 hrs to fix

        Function getQueryInfo has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getQueryInfo() {
                $dbr = $this->getDatabase();
                $conds = [];
                $options = [];
        
        
        Severity: Minor
        Found in includes/specials/pagers/UsersPager.php - About 2 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 formatRow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function formatRow( $row ) {
                if ( $row->user_id == 0 ) { # T18487
                    return '';
                }
        
        
        Severity: Minor
        Found in includes/specials/pagers/UsersPager.php - About 1 hr to fix

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

              public function __construct(
                  IContextSource $context,
                  HookContainer $hookContainer,
                  LinkBatchFactory $linkBatchFactory,
                  IConnectionProvider $dbProvider,
          Severity: Minor
          Found in includes/specials/pagers/UsersPager.php - About 1 hr to fix

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

                protected function doBatchLookups() {
                    $batch = $this->linkBatchFactory->newLinkBatch();
                    $userIds = [];
                    # Give some pointers to make user links
                    foreach ( $this->mResult as $row ) {
            Severity: Minor
            Found in includes/specials/pagers/UsersPager.php - About 1 hr to fix

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

                      IContextSource $context,
                      HookContainer $hookContainer,
                      LinkBatchFactory $linkBatchFactory,
                      IConnectionProvider $dbProvider,
                      UserGroupManager $userGroupManager,
              Severity: Major
              Found in includes/specials/pagers/UsersPager.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,
                        HookContainer $hookContainer,
                        LinkBatchFactory $linkBatchFactory,
                        IConnectionProvider $dbProvider,
                Severity: Minor
                Found in includes/specials/pagers/UsersPager.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 formatRow has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function formatRow( $row ) {
                        if ( $row->user_id == 0 ) { # T18487
                            return '';
                        }
                
                
                Severity: Minor
                Found in includes/specials/pagers/UsersPager.php - About 45 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 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function doBatchLookups() {
                        $batch = $this->linkBatchFactory->newLinkBatch();
                        $userIds = [];
                        # Give some pointers to make user links
                        foreach ( $this->mResult as $row ) {
                Severity: Minor
                Found in includes/specials/pagers/UsersPager.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 getPageHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getPageHeader() {
                        $self = explode( '/', $this->getTitle()->getPrefixedDBkey(), 2 )[0];
                
                        $groupOptions = [ $this->msg( 'group-all' )->text() => '' ];
                        foreach ( $this->getAllGroups() as $group => $groupText ) {
                Severity: Minor
                Found in includes/specials/pagers/UsersPager.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