wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 141 of 272 total issues

Function maybeRetry has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    mw.FormDataTransport.prototype.maybeRetry = function ( contextMsg, code, response, retryMethod, file, offset ) {
Severity: Minor
Found in resources/transports/mw.FormDataTransport.js - About 45 mins to fix

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

        public function onEditFilterMergedContent( IContextSource $context, Content $content, Status $status, $summary,
            User $user, $minoredit
    Severity: Minor
    Found in includes/CampaignHooks.php - About 45 mins to fix

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

          public static function getImageHtml( MediaTransformOutput $thumb, $tutorial ) {
              $helpDeskUrl = wfMessage( 'mwe-upwiz-help-desk-url' )->text();
      
              // Per convention, we may be either using an absolute URL or a wiki page title in this UI message
              if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $helpDeskUrl ) ) {
      Severity: Minor
      Found in includes/Tutorial.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

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

          private function applyObjectReferenceToButtons( $objRef ) {
              $customizableButtons = [ 'homeButton', 'beginButton' ];
      
              foreach ( $customizableButtons as $button ) {
                  if ( isset( $this->parsedConfig['display'][$button]['target'] ) &&
      Severity: Minor
      Found in includes/Campaign.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 onPageSaveComplete has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $wikiPage,
              $userIdentity,
              $summary,
              $flags,
              $revisionRecord,
      Severity: Minor
      Found in includes/CampaignHooks.php - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

                    if (
                        this.descriptionsDetails.getWikiText() === '' &&
                        this.upload.file !== undefined
                    ) {
                        m = this.upload.imageinfo.metadata;
        Severity: Major
        Found in resources/mw.UploadWizardDetails.js - About 40 mins to fix

          Function setDuplicateError has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              mw.ApiUploadHandler.prototype.setDuplicateError = function ( code, result, localDuplicates, foreignDuplicates, unknownAmount ) {
          Severity: Minor
          Found in resources/handlers/mw.ApiUploadHandler.js - About 35 mins to fix

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

                public function execute( $subPage ) {
                    $request = $this->getRequest();
            
                    $start = $request->getIntOrNull( 'start' );
            
            
            Severity: Minor
            Found in includes/Specials/SpecialCampaigns.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

            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

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

                private function trimArray( $array ) {
                    $newArray = [];
                    foreach ( $array as $key => $value ) {
                        if ( is_array( $value ) ) {
                            $trimmedValue = $this->trimArray( $value );
            Severity: Minor
            Found in maintenance/migrateCampaigns.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

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

                public function execute() {
                    $params = $this->extractRequestParams();
            
                    $limit = $params['limit'];
            
            
            Severity: Minor
            Found in includes/ApiQueryAllCampaigns.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

            Avoid too many return statements within this function.
            Open

                    return mw.DestinationChecker.checkTitle( title.getPrefixedText() )
                        .then( ( result ) => {
                            var moreErrors = processDestinationCheck( result );
                            if ( result.blacklist.unavailable ) {
                                // We don't have a title blacklist, so just check for some likely undesirable patterns.
            Severity: Major
            Found in resources/details/uw.TitleDetailsWidget.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return this.submitWikiTextInternal( params );
              Severity: Major
              Found in resources/mw.UploadWizardDetails.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return false;
                Severity: Major
                Found in resources/controller/uw.controller.Upload.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return;
                  Severity: Major
                  Found in resources/handlers/mw.ApiUploadHandler.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return true;
                    Severity: Major
                    Found in resources/controller/uw.controller.Upload.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      return $.Deferred().reject( code, { errors: [ { html: message } ] } );
                      Severity: Major
                      Found in resources/mw.UploadWizardDetails.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                                return this.submitWikiTextInternal( params );
                        Severity: Major
                        Found in resources/mw.UploadWizardDetails.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return $.Deferred().reject( 'this-info-missing', result );
                          Severity: Major
                          Found in resources/mw.UploadWizardDetails.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return false;
                            Severity: Major
                            Found in resources/controller/uw.controller.Upload.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language