wikimedia/mediawiki-extensions-Wikibase

View on GitHub
repo/includes/Store/Sql/WikiPageEntityStore.php

Summary

Maintainability
C
1 day
Test Coverage

File WikiPageEntityStore.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Wikibase\Repo\Store\Sql;

use InvalidArgumentException;
Severity: Minor
Found in repo/includes/Store/Sql/WikiPageEntityStore.php - About 3 hrs to fix

    Method saveEntityContent has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function saveEntityContent(
            EntityContent $entityContent,
            User $user,
            $summary = '',
            $flags = 0,
    Severity: Minor
    Found in repo/includes/Store/Sql/WikiPageEntityStore.php - About 1 hr to fix

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

              EntityContentFactory $contentFactory,
              EntityTitleStoreLookup $entityTitleStoreLookup,
              IdGenerator $idGenerator,
              EntityIdComposer $entityIdComposer,
              RevisionStore $revisionStore,
      Severity: Major
      Found in repo/includes/Store/Sql/WikiPageEntityStore.php - About 1 hr to fix

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

            private function saveEntityContent(
                EntityContent $entityContent,
                User $user,
                $summary = '',
                $flags = 0,
        Severity: Minor
        Found in repo/includes/Store/Sql/WikiPageEntityStore.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 adjustFlagsForMCR has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function adjustFlagsForMCR( $flags, $parentRevision, $slotRole ) {
                if ( $flags & EDIT_UPDATE ) {
                    if ( !$parentRevision ) {
                        throw new StorageException( 'Can\'t perform an update with no parent revision' );
                    }
        Severity: Minor
        Found in repo/includes/Store/Sql/WikiPageEntityStore.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

        Method saveEntityContent has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                EntityContent $entityContent,
                User $user,
                $summary = '',
                $flags = 0,
                $baseRevId = false,
        Severity: Minor
        Found in repo/includes/Store/Sql/WikiPageEntityStore.php - About 45 mins to fix

          Method saveRedirect has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  EntityRedirect $redirect,
                  $summary,
                  User $user,
                  $flags = 0,
                  $baseRevId = false,
          Severity: Minor
          Found in repo/includes/Store/Sql/WikiPageEntityStore.php - About 45 mins to fix

            Method saveEntity has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    EntityDocument $entity,
                    $summary,
                    User $user,
                    $flags = 0,
                    $baseRevId = false,
            Severity: Minor
            Found in repo/includes/Store/Sql/WikiPageEntityStore.php - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status