wikimedia/mediawiki-core

View on GitHub
maintenance/storage/checkStorage.php

Summary

Maintainability
F
6 days
Test Coverage

Function check has a Cognitive Complexity of 147 (exceeds 5 allowed). Consider refactoring.
Open

    public function check( $fix = false, $xml = '' ) {
        $dbr = $this->getReplicaDB();
        if ( $fix ) {
            print "Checking, will fix errors if possible...\n";
        } else {
Severity: Minor
Found in maintenance/storage/checkStorage.php - About 2 days 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 check has 273 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function check( $fix = false, $xml = '' ) {
        $dbr = $this->getReplicaDB();
        if ( $fix ) {
            print "Checking, will fix errors if possible...\n";
        } else {
Severity: Major
Found in maintenance/storage/checkStorage.php - About 1 day to fix

    File checkStorage.php has 450 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Fsck for MediaWiki
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Minor
    Found in maintenance/storage/checkStorage.php - About 6 hrs to fix

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

          private function restoreText( $revIds, $xml ) {
              global $wgDBname;
              $tmpDir = wfTempDir();
      
              if ( !count( $revIds ) ) {
      Severity: Minor
      Found in maintenance/storage/checkStorage.php - About 1 hr to fix

        Method importRevision has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function importRevision( $revision ) {
                $id = $revision->getID();
                $content = $revision->getContent();
                $id = $id ?: '';
        
        
        Severity: Minor
        Found in maintenance/storage/checkStorage.php - About 1 hr to fix

          Method checkExternalConcatBlobs has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function checkExternalConcatBlobs( $externalConcatBlobs ) {
                  if ( !count( $externalConcatBlobs ) ) {
                      return;
                  }
          
          
          Severity: Minor
          Found in maintenance/storage/checkStorage.php - About 1 hr to fix

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

                private function checkExternalConcatBlobs( $externalConcatBlobs ) {
                    if ( !count( $externalConcatBlobs ) ) {
                        return;
                    }
            
            
            Severity: Minor
            Found in maintenance/storage/checkStorage.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 addError has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private function addError( $type, $msg, $ids ) {
                    if ( is_array( $ids ) && count( $ids ) == 1 ) {
                        $ids = reset( $ids );
                    }
                    if ( is_array( $ids ) ) {
            Severity: Minor
            Found in maintenance/storage/checkStorage.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

            There are no issues that match your filters.

            Category
            Status