wikimedia/mediawiki-core

View on GitHub
maintenance/checkDependencies.php

Summary

Maintainability
C
1 day
Test Coverage

Function loadThing has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadThing( &$dependencies, $name, $extensions, $skins ) {
        $extDir = $this->getConfig()->get( MainConfigNames::ExtensionDirectory );
        $styleDir = $this->getConfig()->get( MainConfigNames::StyleDirectory );
        $queue = [];
        $missing = false;
Severity: Minor
Found in maintenance/checkDependencies.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

Function addToDependencies has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private function addToDependencies( &$dependencies, $extensions, $skins,
        $why = null, $status = null, $message = null
    ) {
        $mainRegistry = ExtensionRegistry::getInstance();
        $iter = [ 'extensions' => $extensions, 'skins' => $skins ];
Severity: Minor
Found in maintenance/checkDependencies.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 loadThing has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function loadThing( &$dependencies, $name, $extensions, $skins ) {
        $extDir = $this->getConfig()->get( MainConfigNames::ExtensionDirectory );
        $styleDir = $this->getConfig()->get( MainConfigNames::StyleDirectory );
        $queue = [];
        $missing = false;
Severity: Major
Found in maintenance/checkDependencies.php - About 2 hrs to fix

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

        public function execute() {
            $this->checkDev = $this->hasOption( 'dev' );
            $extensions = $this->hasOption( 'extensions' )
                ? explode( ',', $this->getOption( 'extensions' ) )
                : [];
    Severity: Minor
    Found in maintenance/checkDependencies.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 execute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function execute() {
            $this->checkDev = $this->hasOption( 'dev' );
            $extensions = $this->hasOption( 'extensions' )
                ? explode( ',', $this->getOption( 'extensions' ) )
                : [];
    Severity: Minor
    Found in maintenance/checkDependencies.php - About 1 hr to fix

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

          private function addToDependencies( &$dependencies, $extensions, $skins,
              $why = null, $status = null, $message = null
      Severity: Minor
      Found in maintenance/checkDependencies.php - About 45 mins to fix

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

            private function formatForHumans( $dependencies ) {
                $text = '';
                foreach ( $dependencies as $type => $things ) {
                    $text .= ucfirst( $type ) . "\n" . str_repeat( '=', strlen( $type ) ) . "\n";
                    foreach ( $things as $thing => $info ) {
        Severity: Minor
        Found in maintenance/checkDependencies.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