wikimedia/mediawiki-core

View on GitHub
includes/registration/ExtensionRegistry.php

Summary

Maintainability
D
2 days
Test Coverage

Function exportExtractedData has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    protected function exportExtractedData( array $info ) {
        foreach ( $info['globals'] as $key => $val ) {
            // If a merge strategy is set, read it and remove it from the value
            // so it doesn't accidentally end up getting set.
            if ( is_array( $val ) && isset( $val[self::MERGE_STRATEGY] ) ) {
Severity: Minor
Found in includes/registration/ExtensionRegistry.php - About 6 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

File ExtensionRegistry.php has 366 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use Composer\Semver\Semver;
use MediaWiki\Settings\SettingsBuilder;
use MediaWiki\Shell\Shell;
Severity: Minor
Found in includes/registration/ExtensionRegistry.php - About 4 hrs to fix

    ExtensionRegistry has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ExtensionRegistry {
    
        /**
         * "requires" key that applies to MediaWiki core
         */
    Severity: Minor
    Found in includes/registration/ExtensionRegistry.php - About 3 hrs to fix

      Method exportExtractedData has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function exportExtractedData( array $info ) {
              foreach ( $info['globals'] as $key => $val ) {
                  // If a merge strategy is set, read it and remove it from the value
                  // so it doesn't accidentally end up getting set.
                  if ( is_array( $val ) && isset( $val[self::MERGE_STRATEGY] ) ) {
      Severity: Major
      Found in includes/registration/ExtensionRegistry.php - About 3 hrs to fix

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

            public function readFromQueue( array $queue ) {
                $processor = new ExtensionProcessor();
                $versionChecker = $this->buildVersionChecker();
                $extDependencies = [];
                $warnings = false;
        Severity: Minor
        Found in includes/registration/ExtensionRegistry.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 readFromQueue has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function readFromQueue( array $queue ) {
                $processor = new ExtensionProcessor();
                $versionChecker = $this->buildVersionChecker();
                $extDependencies = [];
                $warnings = false;
        Severity: Minor
        Found in includes/registration/ExtensionRegistry.php - About 1 hr to fix

          Function saveToCache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function saveToCache( BagOStuff $cache, array $data ) {
                  global $wgDevelopmentWarnings;
                  if ( $data['warnings'] && $wgDevelopmentWarnings ) {
                      // If warnings were shown, don't cache it
                      return;
          Severity: Minor
          Found in includes/registration/ExtensionRegistry.php - About 25 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