wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 141 of 272 total issues

Function MWUploadWizardUploadInterface has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    mw.UploadWizardUploadInterface = function MWUploadWizardUploadInterface( upload ) {
        var ui = this;

        OO.EventEmitter.call( this );

Severity: Major
Found in resources/mw.UploadWizardUploadInterface.js - About 2 hrs to fix

    Function getWikiText has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            getWikiText: function () {
                var deed, info, key,
                    information,
                    wikiText = '';
    
    
    Severity: Major
    Found in resources/mw.UploadWizardDetails.js - About 2 hrs to fix

      Function checkUniqueProcessor has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  function checkUniqueProcessor( data ) {
                      var result, protection, pageId, ntitle, ntitleObj, img;
      
                      result = { isUnique: true };
      
      
      Severity: Major
      Found in resources/mw.DestinationChecker.js - About 2 hrs to fix

        Function makePreview has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            mw.UploadWizardUpload.prototype.makePreview = function ( width ) {
                var first, video, url, dataUrlReader,
                    deferred = $.Deferred(),
                    upload = this;
        
        
        Severity: Minor
        Found in resources/mw.UploadWizardUpload.js - About 1 hr to fix

          Function start has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  start: function () {
                      var bar = this,
                          shown = false;
          
                      this.setBeginTime();
          Severity: Minor
          Found in resources/mw.GroupProgressBar.js - About 1 hr to fix

            Function createLabel has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                uw.LicenseGroup.prototype.createLabel = function ( name ) {
                    var licenseInfo = this.getLicenseInfo( name ),
                        messageKey = licenseInfo.props.msg === undefined ?
                            '[missing msg for ' + licenseInfo.name + ']' :
                            licenseInfo.props.msg,
            Severity: Minor
            Found in resources/uw.LicenseGroup.js - About 1 hr to fix

              Function processDestinationCheck has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  uw.TitleDetailsWidget.prototype.processDestinationCheck = function ( result ) {
                      var messageParams, errors, titleString;
              
                      if ( result.unique.isUnique && result.blacklist.notBlacklisted && !result.unique.isProtected ) {
                          return [];
              Severity: Minor
              Found in resources/details/uw.TitleDetailsWidget.js - About 1 hr to fix

                Function onGetPreferences has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function onGetPreferences( $user, &$preferences ) {
                        $config = Config::getConfig();
                
                        // User preference to skip the licensing tutorial, provided it's not globally disabled
                        if ( Config::getSetting( 'tutorial' ) != [] ) {
                Severity: Minor
                Found in includes/Hooks.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 getHtml has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getHtml( $campaign = null ) {
                        global $wgLang;
                
                        $error = null;
                        $errorHtml = '';
                Severity: Minor
                Found in includes/Tutorial.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 addNextButton has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    uw.ui.Upload.prototype.addNextButton = function () {
                        var ui = this;
                
                        this.nextButtonPromise.done( () => {
                            ui.$buttons.append(
                Severity: Minor
                Found in resources/ui/steps/uw.ui.Upload.js - About 1 hr to fix

                  Function getImageInfo has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      mw.UploadWizardUpload.prototype.getImageInfo = function ( callback, props, width, height ) {
                          var requestedTitle, params;
                  
                          function ok( data ) {
                              var found;
                  Severity: Minor
                  Found in resources/mw.UploadWizardUpload.js - About 1 hr to fix

                    Function UWLocationDetailsWidget has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        uw.LocationDetailsWidget = function UWLocationDetailsWidget( config ) {
                            this.config = config || {};
                    
                            uw.LocationDetailsWidget.super.call( this );
                    
                    
                    Severity: Minor
                    Found in resources/details/uw.LocationDetailsWidget.js - About 1 hr to fix

                      Function parseArrayValues has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function parseArrayValues( $array, Language $lang, $forKeys = null ) {
                              $parsed = [];
                              foreach ( $array as $key => $value ) {
                                  if ( $forKeys !== null ) {
                                      if ( in_array( $key, $forKeys ) ) {
                      Severity: Minor
                      Found in includes/Campaign.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 modifyIfNecessary has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function modifyIfNecessary() {
                              foreach ( $this->parsedConfig as $cnf => $modifiers ) {
                                  if ( $cnf === 'whileActive' && $this->isActive() ) {
                                      $activeModifiers = $modifiers;
                                  } elseif ( $cnf === 'afterActive' && $this->wasActive() ) {
                      Severity: Minor
                      Found in includes/Campaign.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 getApiThumbnail has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          mw.UploadWizardUpload.prototype.getApiThumbnail = function ( width, height ) {
                              var deferred = $.Deferred();
                      
                              function thumbnailPublisher( thumbnails ) {
                                  if ( thumbnails === null ) {
                      Severity: Minor
                      Found in resources/mw.UploadWizardUpload.js - About 1 hr to fix

                        Function UWSingleLanguageInputWidget has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            uw.SingleLanguageInputWidget = function UWSingleLanguageInputWidget( config ) {
                                this.config = $.extend( {
                                    inputWidgetConstructor: OO.ui.MultilineTextInputWidget.bind( null, {
                                        classes: [ 'mwe-upwiz-singleLanguageInputWidget-text' ],
                                        autosize: true
                        Severity: Minor
                        Found in resources/details/uw.SingleLanguageInputWidget.js - About 1 hr to fix

                          Function getErrors has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              getErrors: function () {
                                  var errors = $.Deferred().resolve( [] ).promise();
                                  var addError = function ( message ) {
                                      errors = errors.then( ( errors ) => {
                                          errors.push( mw.message( message ) );
                          Severity: Minor
                          Found in resources/mw.UploadWizardLicenseInput.js - About 1 hr to fix

                            Function setSerialized has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    setSerialized: function ( serialized ) {
                                        var i;
                            
                                        if ( !this.interfaceBuilt ) {
                                            // There's no interface yet! Don't load the data, just keep it
                            Severity: Minor
                            Found in resources/mw.UploadWizardDetails.js - About 1 hr to fix

                              Function extractMetadataFromJpegMeta has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  mw.UploadWizardUpload.prototype.extractMetadataFromJpegMeta = function () {
                                      var binReader, jpegmeta,
                                          deferred = $.Deferred(),
                                          upload = this;
                                      if ( this.file && this.file.type === 'image/jpeg' ) {
                              Severity: Minor
                              Found in resources/mw.UploadWizardUpload.js - About 1 hr to fix

                                Function displayer has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                            function displayer() {
                                                var totalWeight = 0.0,
                                                    fraction = 0.0,
                                                    successStateCount = 0,
                                                    errorStateCount = 0,
                                Severity: Minor
                                Found in resources/mw.GroupProgressBar.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language