wikimedia/mediawiki-core

View on GitHub
includes/specials/SpecialContributions.php

Summary

Maintainability
F
1 wk
Test Coverage

File SpecialContributions.php has 752 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Implements Special:Contributions
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Major
Found in includes/specials/SpecialContributions.php - About 1 day to fix

    Function execute has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

        public function execute( $par ) {
            $this->setHeaders();
            $this->outputHeader();
            $out = $this->getOutput();
            // Modules required for viewing the list of contributions (also when included on other pages)
    Severity: Minor
    Found in includes/specials/SpecialContributions.php - About 1 day 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 execute has 201 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function execute( $par ) {
            $this->setHeaders();
            $this->outputHeader();
            $out = $this->getOutput();
            // Modules required for viewing the list of contributions (also when included on other pages)
    Severity: Major
    Found in includes/specials/SpecialContributions.php - About 1 day to fix

      Method getForm has 178 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getForm( array $pagerOptions ) {
              if ( $this->including() ) {
                  // Do not show a form when special page is included in wikitext
                  return '';
              }
      Severity: Major
      Found in includes/specials/SpecialContributions.php - About 7 hrs to fix

        Function contributionsSub has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function contributionsSub( $userObj, $targetName ) {
                $isAnon = $userObj->isAnon();
                if ( !$isAnon && $userObj->isHidden() &&
                    !$this->permissionManager->userHasRight( $this->getUser(), 'hideuser' )
                ) {
        Severity: Minor
        Found in includes/specials/SpecialContributions.php - About 5 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 contributionsSub has 119 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function contributionsSub( $userObj, $targetName ) {
                $isAnon = $userObj->isAnon();
                if ( !$isAnon && $userObj->isHidden() &&
                    !$this->permissionManager->userHasRight( $this->getUser(), 'hideuser' )
                ) {
        Severity: Major
        Found in includes/specials/SpecialContributions.php - About 4 hrs to fix

          Method getUserLinks has 103 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getUserLinks(
                  SpecialPage $sp,
                  User $target,
                  PermissionManager $permissionManager = null,
                  HookRunner $hookRunner = null
          Severity: Major
          Found in includes/specials/SpecialContributions.php - About 4 hrs to fix

            Function getUserLinks has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getUserLinks(
                    SpecialPage $sp,
                    User $target,
                    PermissionManager $permissionManager = null,
                    HookRunner $hookRunner = null
            Severity: Minor
            Found in includes/specials/SpecialContributions.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

            Function getForm has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function getForm( array $pagerOptions ) {
                    if ( $this->including() ) {
                        // Do not show a form when special page is included in wikitext
                        return '';
                    }
            Severity: Minor
            Found in includes/specials/SpecialContributions.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

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

                    LinkBatchFactory $linkBatchFactory = null,
                    PermissionManager $permissionManager = null,
                    IConnectionProvider $dbProvider = null,
                    RevisionStore $revisionStore = null,
                    NamespaceInfo $namespaceInfo = null,
            Severity: Major
            Found in includes/specials/SpecialContributions.php - About 1 hr to fix

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

                  private function getPager( $targetUser ) {
                      if ( $this->pager === null ) {
                          $options = [
                              'namespace' => $this->opts['namespace'],
                              'tagfilter' => $this->opts['tagfilter'],
              Severity: Minor
              Found in includes/specials/SpecialContributions.php - About 1 hr to fix

                Avoid too many return statements within this method.
                Open

                            return;
                Severity: Major
                Found in includes/specials/SpecialContributions.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return;
                  Severity: Major
                  Found in includes/specials/SpecialContributions.php - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status