wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub
includes/ChangeListener.php

Summary

Maintainability
B
5 hrs
Test Coverage

Method onLinksUpdateComplete has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function onLinksUpdateComplete( $linksUpdate, $ticket ) {
        if ( !$this->isEnabled() ) {
            return;
        }
        // defer processing the LinksUpdateComplete hook until other hooks tagged in PageChangeTracker
Severity: Minor
Found in includes/ChangeListener.php - About 1 hr to fix

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

        public function onPageDeleteComplete( ProperPageIdentity $page, Authority $deleter,
            string $reason, int $pageID, RevisionRecord $deletedRev, ManualLogEntry $logEntry,
            int $archivedRevisionCount
    Severity: Major
    Found in includes/ChangeListener.php - About 50 mins to fix

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

              $old, $new, $user, $pageid, $redirid,
              $reason, $revision
      Severity: Major
      Found in includes/ChangeListener.php - About 50 mins to fix

        Method onPageDelete has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                ProperPageIdentity $page,
                Authority $deleter,
                string $reason,
                \StatusValue $status,
                bool $suppress
        Severity: Minor
        Found in includes/ChangeListener.php - About 35 mins to fix

          Method onTitleMove has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function onTitleMove( Title $old, Title $nt, User $user, $reason, Status &$status ) {
          Severity: Minor
          Found in includes/ChangeListener.php - About 35 mins to fix

            Function onLinksUpdateComplete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function onLinksUpdateComplete( $linksUpdate, $ticket ) {
                    if ( !$this->isEnabled() ) {
                        return;
                    }
                    // defer processing the LinksUpdateComplete hook until other hooks tagged in PageChangeTracker
            Severity: Minor
            Found in includes/ChangeListener.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 preparePageReferencesForLinksUpdate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function preparePageReferencesForLinksUpdate( $pageReferences, int $max, $excludeBadUTF = false ) {
                    $pageReferences = self::pickFromArray( $pageReferences, $max );
                    $dBKeys = [];
                    foreach ( $pageReferences as $pageReference ) {
                        $title = Title::newFromPageReference( $pageReference );
            Severity: Minor
            Found in includes/ChangeListener.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