wikimedia/mediawiki-core

View on GitHub
maintenance/purgeList.php

Summary

Maintainability
B
5 hrs
Test Coverage

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

    private function doPurge() {
        $stdin = $this->getStdin();
        $urls = [];
        $htmlCacheUpdater = $this->getServiceContainer()->getHtmlCacheUpdater();

Severity: Minor
Found in maintenance/purgeList.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

Method purgeNamespace has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function purgeNamespace( $namespace = false ) {
        if ( $this->doDbTouch ) {
            // NOTE: If support for this is added in the future,
            // it MUST NOT be allowed when $wgMiserMode is enabled.
            // Change this to a check and error about instead! (T263957)
Severity: Minor
Found in maintenance/purgeList.php - About 1 hr to fix

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

        private function sendPurgeRequest( $urls ) {
            $hcu = $this->getServiceContainer()->getHtmlCacheUpdater();
            if ( $this->delay > 0 ) {
                foreach ( $urls as $url ) {
                    if ( $this->hasOption( 'verbose' ) ) {
    Severity: Minor
    Found in maintenance/purgeList.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 purgeNamespace has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function purgeNamespace( $namespace = false ) {
            if ( $this->doDbTouch ) {
                // NOTE: If support for this is added in the future,
                // it MUST NOT be allowed when $wgMiserMode is enabled.
                // Change this to a check and error about instead! (T263957)
    Severity: Minor
    Found in maintenance/purgeList.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