wikimedia/mediawiki-core

View on GitHub
maintenance/storage/moveToExternal.php

Summary

Maintainability
D
2 days
Test Coverage

Function doMoveToExternal has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Open

    private function doMoveToExternal() {
        $success = true;
        $dbr = $this->getReplicaDB();

        $count = $this->maxID - $this->minID + 1;
Severity: Minor
Found in maintenance/storage/moveToExternal.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 doMoveToExternal has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function doMoveToExternal() {
        $success = true;
        $dbr = $this->getReplicaDB();

        $count = $this->maxID - $this->minID + 1;
Severity: Major
Found in maintenance/storage/moveToExternal.php - About 4 hrs to fix

    File moveToExternal.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Move text from the text table to external storage
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Minor
    Found in maintenance/storage/moveToExternal.php - About 2 hrs to fix

      Method execute has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function execute() {
              $this->resolveStubs = new ResolveStubs;
              $this->esType = $this->getArg( 0 ); // e.g. "DB" or "mwstore"
              $this->esLocation = $this->getArg( 1 ); // e.g. "cluster12" or "global-swift"
              $dbw = $this->getPrimaryDB();
      Severity: Minor
      Found in maintenance/storage/moveToExternal.php - About 1 hr to fix

        Function resolveLegacyEncoding has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private function resolveLegacyEncoding( $text, $flags ) {
                if ( $this->legacyEncoding !== null
                    && !in_array( 'utf-8', $flags )
                    && !in_array( 'utf8', $flags )
                ) {
        Severity: Minor
        Found in maintenance/storage/moveToExternal.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 resolveStubs has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function resolveStubs( $stubIDs ) {
                if ( $this->dryRun ) {
                    print "Note: resolving stubs in dry run mode is expected to fail, " .
                        "because the main blobs have not been moved to external storage.\n";
                }
        Severity: Minor
        Found in maintenance/storage/moveToExternal.php - About 1 hr to fix

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

              public function execute() {
                  $this->resolveStubs = new ResolveStubs;
                  $this->esType = $this->getArg( 0 ); // e.g. "DB" or "mwstore"
                  $this->esLocation = $this->getArg( 1 ); // e.g. "cluster12" or "global-swift"
                  $dbw = $this->getPrimaryDB();
          Severity: Minor
          Found in maintenance/storage/moveToExternal.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 resolveStubs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function resolveStubs( $stubIDs ) {
                  if ( $this->dryRun ) {
                      print "Note: resolving stubs in dry run mode is expected to fail, " .
                          "because the main blobs have not been moved to external storage.\n";
                  }
          Severity: Minor
          Found in maintenance/storage/moveToExternal.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

          There are no issues that match your filters.

          Category
          Status