wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 141 of 272 total issues

File mw.UploadWizardDetails.js has 912 lines of code (exceeds 250 allowed). Consider refactoring.
Open

( function ( uw ) {

    var NS_FILE = mw.config.get( 'wgNamespaceIds' ).file;

    /**
Severity: Major
Found in resources/mw.UploadWizardDetails.js - About 2 days to fix

    Function UWDeedOwnWork has 285 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        uw.deed.OwnWork = function UWDeedOwnWork( config, uploads, api ) {
            var self = this,
                prefAuthName = mw.user.options.get( 'upwiz_licensename' ),
                revealOptionContent = function ( $parent, $child ) {
                    // hide sub-content for all options
    Severity: Major
    Found in resources/deed/uw.deed.OwnWork.js - About 1 day to fix

      Function buildInterface has 238 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              buildInterface: function () {
                  var descriptionRequired, uri,
                      details = this,
                      config = mw.UploadWizard.config,
                      captionsAvailable = config.wikibase.enabled && config.wikibase.captions;
      Severity: Major
      Found in resources/mw.UploadWizardDetails.js - About 1 day to fix

        File mw.UploadWizardUpload.js has 541 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * Represents the upload -- in its local and remote state. (Possibly those could be separate objects too...)
         * This is our 'model' object if we are thinking MVC. Needs to be better factored, lots of feature envy with the UploadWizard
         * states:
         *   'new' 'transporting' 'transported' 'metadata' 'stashed' 'details' 'submitting-details' 'complete' 'error'
        Severity: Major
        Found in resources/mw.UploadWizardUpload.js - About 1 day to fix

          File mw.FlickrChecker.js has 498 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* eslint-disable camelcase, no-underscore-dangle */
          
          /**
           * @param ui
           * @param selectButton
          Severity: Minor
          Found in resources/mw.FlickrChecker.js - About 7 hrs to fix

            File UploadWizard.config.php has 482 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * Upload Wizard Configuration
             * Do not modify this file, instead use localsettings.php and set:
             * $wgUploadWizardConfig[ 'name'] =  'value';
            Severity: Minor
            Found in UploadWizard.config.php - About 7 hrs to fix

              File uw.deed.OwnWork.js has 449 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               * This file is part of the MediaWiki extension UploadWizard.
               *
               * UploadWizard 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 resources/deed/uw.deed.OwnWork.js - About 6 hrs to fix

                File CampaignSchema.php has 397 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                use MediaWiki\Extension\UploadWizard\Config;
                
                return [
                Severity: Minor
                Found in includes/CampaignSchema.php - About 5 hrs to fix

                  Function UWUIUpload has 130 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      uw.ui.Upload = function UWUIUpload( config ) {
                          var upload = this;
                  
                          this.config = config;
                  
                  
                  Severity: Major
                  Found in resources/ui/steps/uw.ui.Upload.js - About 5 hrs to fix

                    Function UWDeedThirdParty has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        uw.deed.ThirdParty = function UWDeedThirdParty( config, uploads, api ) {
                            var deed = this;
                    
                            uw.deed.Abstract.call( this, 'thirdparty', config, uploads );
                    
                    
                    Severity: Major
                    Found in resources/deed/uw.deed.ThirdParty.js - About 4 hrs to fix

                      Function getPhotos has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          getPhotos: function ( mode, options ) {
                              this.selectButton.setLabel( mw.message( 'mwe-upwiz-select-flickr' ).text() );
                              this.selectButton.setDisabled( true );
                      
                              var req = $.extend( {}, options, {
                      Severity: Major
                      Found in resources/mw.FlickrChecker.js - About 4 hrs to fix

                        File uw.ui.Upload.js has 368 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /*
                         * This file is part of the MediaWiki extension UploadWizard.
                         *
                         * UploadWizard 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 resources/ui/steps/uw.ui.Upload.js - About 4 hrs to fix

                          Function lazyload has 116 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              $.fn.lazyload = function(options) {
                                  var elements = this;
                                  var $container;
                                  var settings = {
                                      threshold       : 0,
                          Severity: Major
                          Found in resources/jquery/jquery.lazyload.js - About 4 hrs to fix

                            Method generateReadHtml has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function generateReadHtml() {
                                    $config = $this->campaign->getParsedConfig();
                            
                                    $campaignTitle = $config['title'] ?? $this->campaign->getName();
                                    $campaignDescription = $config['description'] ?? '';
                            Severity: Major
                            Found in includes/CampaignPageFormatter.php - About 4 hrs to fix

                              Function getParsedConfig has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function getParsedConfig( Language $lang = null ) {
                                      if ( $lang === null ) {
                                          $lang = $this->context->getLanguage();
                                      }
                              
                              
                              Severity: Minor
                              Found in includes/Campaign.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

                              Function validateWikiTextSubmitResult has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      validateWikiTextSubmitResult: function ( params, result ) {
                                          var wx, warningsKeys, existingFile, existingFileUrl, existingFileExt, ourFileExt, code, message,
                                              details = this,
                                              warnings = null,
                                              ignoreTheseWarnings = false,
                              Severity: Major
                              Found in resources/mw.UploadWizardDetails.js - About 3 hrs to fix

                                Function checkUnique has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        checkUnique: function ( title ) {
                                            var checker = this,
                                                NS_FILE = mw.config.get( 'wgNamespaceIds' ).file,
                                                titleObj, prefix, ext;
                                
                                
                                Severity: Major
                                Found in resources/mw.DestinationChecker.js - About 3 hrs to fix

                                  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

                                  File Campaign.php has 309 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  
                                  namespace MediaWiki\Extension\UploadWizard;
                                  
                                  use InvalidArgumentException;
                                  Severity: Minor
                                  Found in includes/Campaign.php - About 3 hrs to fix

                                    Function UploadWizardLicenseInput has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    mw.UploadWizardLicenseInput = function ( config, count, api ) {
                                        mw.UploadWizardLicenseInput.super.call( this );
                                        OO.ui.mixin.GroupElement.call( this );
                                    
                                        this.count = count;
                                    Severity: Major
                                    Found in resources/mw.UploadWizardLicenseInput.js - About 3 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language