wikimedia/mediawiki-core

View on GitHub
includes/registration/VersionChecker.php

Summary

Maintainability
D
2 days
Test Coverage

Function checkArray has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkArray( array $extDependencies ) {
        $errors = [];
        foreach ( $extDependencies as $extension => $dependencies ) {
            foreach ( $dependencies as $dependencyType => $values ) {
                switch ( $dependencyType ) {
Severity: Minor
Found in includes/registration/VersionChecker.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 checkArray has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function checkArray( array $extDependencies ) {
        $errors = [];
        foreach ( $extDependencies as $extension => $dependencies ) {
            foreach ( $dependencies as $dependencyType => $values ) {
                switch ( $dependencyType ) {
Severity: Major
Found in includes/registration/VersionChecker.php - About 4 hrs to fix

    Method handleExtensionDependency has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function handleExtensionDependency( $dependencyName, $constraint, $checkedExt,
            $type
        ) {
            // Check if the dependency is even installed
            if ( !isset( $this->loaded[$dependencyName] ) ) {
    Severity: Minor
    Found in includes/registration/VersionChecker.php - About 1 hr to fix

      Function handleExtensionDependency has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private function handleExtensionDependency( $dependencyName, $constraint, $checkedExt,
              $type
          ) {
              // Check if the dependency is even installed
              if ( !isset( $this->loaded[$dependencyName] ) ) {
      Severity: Minor
      Found in includes/registration/VersionChecker.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

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

              $coreVersion, $phpVersion, array $phpExtensions,
              array $abilities = [], array $abilityErrors = []
      Severity: Minor
      Found in includes/registration/VersionChecker.php - About 35 mins to fix

        Avoid too many return statements within this method.
        Open

                        return [
                            'msg' => $msg,
                            'type' => "incompatible-$type",
                            'incompatible' => $checkedExt,
                        ];
        Severity: Major
        Found in includes/registration/VersionChecker.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return false;
          Severity: Major
          Found in includes/registration/VersionChecker.php - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status