wikimedia/mediawiki-extensions-UploadWizard

View on GitHub
includes/Specials/SpecialUploadWizard.php

Summary

Maintainability
C
1 day
Test Coverage

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

    public function addJsVars( $subPage ) {
        $config = Config::getConfig( $this->campaign );

        if ( array_key_exists( 'trackingCategory', $config ) ) {
            if ( array_key_exists( 'campaign', $config['trackingCategory'] ) ) {
Severity: Minor
Found in includes/Specials/SpecialUploadWizard.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 addJsVars has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addJsVars( $subPage ) {
        $config = Config::getConfig( $this->campaign );

        if ( array_key_exists( 'trackingCategory', $config ) ) {
            if ( array_key_exists( 'campaign', $config['trackingCategory'] ) ) {
Severity: Major
Found in includes/Specials/SpecialUploadWizard.php - About 2 hrs to fix

    Method execute has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function execute( $subPage ) {
            // side effects: if we can't upload, will print error page to wgOut
            // and return false
            if ( !( $this->isUploadAllowed() && $this->isUserUploadAllowed( $this->getUser() ) ) ) {
                return;
    Severity: Major
    Found in includes/Specials/SpecialUploadWizard.php - About 2 hrs to fix

      Method getWizardHtml has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getWizardHtml() {
              $config = Config::getConfig( $this->campaign );
      
              if ( array_key_exists(
                  'display', $config ) && array_key_exists( 'headerLabel', $config['display'] )
      Severity: Minor
      Found in includes/Specials/SpecialUploadWizard.php - About 1 hr to fix

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

            public function execute( $subPage ) {
                // side effects: if we can't upload, will print error page to wgOut
                // and return false
                if ( !( $this->isUploadAllowed() && $this->isUserUploadAllowed( $this->getUser() ) ) ) {
                    return;
        Severity: Minor
        Found in includes/Specials/SpecialUploadWizard.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

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

            protected function handleCampaign() {
                $campaignName = $this->getRequest()->getVal( 'campaign' );
                if ( $campaignName === null ) {
                    $campaignName = Config::getSetting( 'defaultCampaign' );
                }
        Severity: Minor
        Found in includes/Specials/SpecialUploadWizard.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