wikimedia/mediawiki-core

View on GitHub
includes/installer/WebInstallerOptions.php

Summary

Maintainability
F
4 days
Test Coverage

Function addExtensionOptions has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

    private function addExtensionOptions(): void {
        global $wgLang;

        $extensions = $this->parent->findExtensions()->value;
        '@phan-var array[] $extensions';
Severity: Minor
Found in includes/installer/WebInstallerOptions.php - About 7 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 WebInstallerOptions.php has 438 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
Severity: Minor
Found in includes/installer/WebInstallerOptions.php - About 6 hrs to fix

    Function submit has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        public function submit() {
            $this->parent->setVarsFromRequest( [ '_RightsProfile', '_LicenseCode',
                'wgEnableEmail', 'wgPasswordSender', 'wgEnableUploads',
                '_Logo1x', '_LogoWordmark', '_LogoTagline', '_LogoIcon',
                'wgEnableUserEmail', 'wgEnotifUserTalk', 'wgEnotifWatchlist',
    Severity: Minor
    Found in includes/installer/WebInstallerOptions.php - About 3 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 submit has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function submit() {
            $this->parent->setVarsFromRequest( [ '_RightsProfile', '_LicenseCode',
                'wgEnableEmail', 'wgPasswordSender', 'wgEnableUploads',
                '_Logo1x', '_LogoWordmark', '_LogoTagline', '_LogoIcon',
                'wgEnableUserEmail', 'wgEnotifUserTalk', 'wgEnotifWatchlist',
    Severity: Major
    Found in includes/installer/WebInstallerOptions.php - About 2 hrs to fix

      Method addExtensionOptions has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function addExtensionOptions(): void {
              global $wgLang;
      
              $extensions = $this->parent->findExtensions()->value;
              '@phan-var array[] $extensions';
      Severity: Major
      Found in includes/installer/WebInstallerOptions.php - About 2 hrs to fix

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

            private function addPersonalizationOptions() {
                $parent = $this->parent;
                $this->addHTML(
                    $this->getFieldsetStart( 'config-personalization-settings' ) .
                    Html::rawElement( 'div', [
        Severity: Minor
        Found in includes/installer/WebInstallerOptions.php - About 1 hr to fix

          Method addEmailOptions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function addEmailOptions(): void {
                  $emailwrapperStyle = $this->getVar( 'wgEnableEmail' ) ? '' : 'display: none';
                  $this->addHTML(
                      $this->getFieldsetStart( 'config-email-settings' ) .
                      $this->parent->getCheckBox( [
          Severity: Minor
          Found in includes/installer/WebInstallerOptions.php - About 1 hr to fix

            Method addSkinOptions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function addSkinOptions(): void {
                    $skins = $this->parent->findExtensions( 'skins' )->value;
                    '@phan-var array[] $skins';
                    $skinHtml = $this->getFieldsetStart( 'config-skins' );
            
            
            Severity: Minor
            Found in includes/installer/WebInstallerOptions.php - About 1 hr to fix

              Method addAdvancedOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function addAdvancedOptions(): void {
                      $caches = [ 'none' ];
                      $cachevalDefault = 'none';
              
                      if ( count( $this->getVar( '_Caches' ) ) ) {
              Severity: Minor
              Found in includes/installer/WebInstallerOptions.php - About 1 hr to fix

                Method addFileOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function addFileOptions(): void {
                        // Having / in paths in Windows looks funny :)
                        $this->setVar( 'wgDeletedDirectory',
                            str_replace(
                                '/', DIRECTORY_SEPARATOR,
                Severity: Minor
                Found in includes/installer/WebInstallerOptions.php - About 1 hr to fix

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

                      private function addSkinOptions(): void {
                          $skins = $this->parent->findExtensions( 'skins' )->value;
                          '@phan-var array[] $skins';
                          $skinHtml = $this->getFieldsetStart( 'config-skins' );
                  
                  
                  Severity: Minor
                  Found in includes/installer/WebInstallerOptions.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

                  There are no issues that match your filters.

                  Category
                  Status