wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 272 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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if ( latNum > 90 || latNum < -90 || ( latNum === 0 && latInput.indexOf( '0' ) < 0 ) || isNaN( latNum ) ) {
                                  errors.push( mw.message( 'mwe-upwiz-error-latitude' ) );
                              }
                  Severity: Major
                  Found in resources/details/uw.LocationDetailsWidget.js and 1 other location - About 1 hr to fix
                  resources/details/uw.LocationDetailsWidget.js on lines 125..127

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 72.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      uw.controller.Step.prototype.movePrevious = function () {
                          this.unload();
                  
                          if ( this.previousStep ) {
                              this.previousStep.load( this.uploads );
                  Severity: Major
                  Found in resources/controller/uw.controller.Step.js and 1 other location - About 1 hr to fix
                  resources/controller/uw.controller.Step.js on lines 159..165

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 72.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      uw.controller.Step.prototype.moveNext = function () {
                          this.unload();
                  
                          if ( this.nextStep ) {
                              this.nextStep.load( this.uploads );
                  Severity: Major
                  Found in resources/controller/uw.controller.Step.js and 1 other location - About 1 hr to fix
                  resources/controller/uw.controller.Step.js on lines 170..176

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 72.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if ( lonNum > 180 || lonNum < -180 || ( lonNum === 0 && lonInput.indexOf( '0' ) < 0 ) || isNaN( lonNum ) ) {
                                  errors.push( mw.message( 'mwe-upwiz-error-longitude' ) );
                              }
                  Severity: Major
                  Found in resources/details/uw.LocationDetailsWidget.js and 1 other location - About 1 hr to fix
                  resources/details/uw.LocationDetailsWidget.js on lines 121..123

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 72.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  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
                          Severity
                          Category
                          Status
                          Source
                          Language