wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 260 of 260 total issues

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

    public function execute() {
        $services = $this->getServiceContainer();

        $username = $this->getOption( 'user', 'Maintenance script' );

Severity: Minor
Found in maintenance/migrateCampaigns.php - About 1 hr to fix

    Function buildCollectionLinks has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        buildCollectionLinks: function ( appendId, data ) {
            var $elem = $( '<ul>' );
            if ( appendId ) {
                $elem.attr( 'id', 'mwe-upwiz-files-collection-chooser' );
            }
    Severity: Minor
    Found in resources/mw.FlickrChecker.js - About 1 hr to fix

      Function exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function ( grunt ) {
          const conf = grunt.file.readJSON( 'extension.json' );
      
          grunt.loadNpmTasks( 'grunt-banana-checker' );
          grunt.loadNpmTasks( 'grunt-contrib-watch' );
      Severity: Minor
      Found in Gruntfile.js - About 1 hr to fix

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

            uw.CategoriesDetailsWidget.prototype.getWikiText = function () {
                var hiddenCats, missingCatsWikiText, categories, wikiText;
        
                hiddenCats = [];
                if ( mw.UploadWizard.config.autoAdd.categories ) {
        Severity: Minor
        Found in resources/details/uw.CategoriesDetailsWidget.js - About 1 hr to fix

          Function updateAuthorFieldForAI has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              uw.deed.ThirdParty.prototype.updateAuthorFieldForAI = function () {
                  if ( this.templateOptions.aiGenerated.input.isSelected() ) {
                      this.authorInputField.setLabel(
                          $( '<li>' )
                              .addClass( 'mwe-upwiz-label-title' )
          Severity: Minor
          Found in resources/deed/uw.deed.ThirdParty.js - About 1 hr to fix

            Function processError has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    processError: function ( code, result ) {
                        var recoverable = [
                            'abusefilter-disallowed',
                            'abusefilter-warning',
                            'spamblacklist',
            Severity: Minor
            Found in resources/mw.UploadWizardDetails.js - About 1 hr to fix

              Function setTransportWarning has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  mw.ApiUploadHandler.prototype.setTransportWarning = function ( code, result ) {
                      var param, duplicates, links;
              
                      switch ( code ) {
                          case 'duplicate':
              Severity: Minor
              Found in resources/handlers/mw.ApiUploadHandler.js - About 1 hr to fix

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

                    uw.controller.Step.prototype.setPreviousStep = function ( step ) {
                        this.previousStep = step;
                        this.ui.enablePreviousButton();
                    };
                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 99..102

                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 58.

                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.deed.OwnWork.prototype.getOwnWorkWarnings = function () {
                        return $.Deferred().resolve( [] ).promise();
                    };
                Severity: Major
                Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 1 hr to fix
                resources/deed/uw.deed.OwnWork.js on lines 599..601

                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 58.

                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.setNextStep = function ( step ) {
                        this.nextStep = step;
                        this.ui.enableNextButton();
                    };
                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 109..112

                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 58.

                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.deed.OwnWork.prototype.getAuthorWarnings = function () {
                        return $.Deferred().resolve( [] ).promise();
                    };
                Severity: Major
                Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 1 hr to fix
                resources/deed/uw.deed.OwnWork.js on lines 570..572

                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 58.

                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

                Method getUploadStashFile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function getUploadStashFile( string $fileKey ): UploadStashFile {
                        $filePath = $this->dbr->selectField(
                            'uploadstash',
                            'us_path',
                            [ 'us_key' => $fileKey ],
                Severity: Minor
                Found in includes/ApiMediaDetection.php - About 1 hr to fix

                  Function setDuplicateError has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      mw.ApiUploadHandler.prototype.setDuplicateError = function ( code, result, localDuplicates, foreignDuplicates, unknownAmount ) {
                          var allDuplicates = Object.assign( {}, localDuplicates, foreignDuplicates ),
                              $extra = $( '<div>' ),
                              $ul = $( '<ul>' ).appendTo( $extra ),
                              $a,
                  Severity: Minor
                  Found in resources/handlers/mw.ApiUploadHandler.js - About 1 hr to fix

                    Function UWUIDetails has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        uw.ui.Details = function UWUIDetails() {
                            var details = this;
                    
                            function startDetails() {
                                details.emit( 'start-details' );
                    Severity: Minor
                    Found in resources/ui/steps/uw.ui.Details.js - About 1 hr to fix

                      Function UWDateDetailsWidget has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          uw.DateDetailsWidget = function UWDateDetailsWidget( config ) {
                              uw.DateDetailsWidget.super.call( this );
                      
                              this.upload = config.upload;
                              this.dateInputWidgetMode = null; // or: 'calendar', 'arbitrary'
                      Severity: Minor
                      Found in resources/details/uw.DateDetailsWidget.js - About 1 hr to fix

                        Method onBeforePageDisplay has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function onBeforePageDisplay( $out, $skin ): void {
                                $config = MediaWikiServices::getInstance()->getMainConfig();
                        
                                if ( ExtensionRegistry::getInstance()->isLoaded( 'WikibaseMediaInfo' ) ) {
                                    $properties = $config->get( 'MediaInfoProperties' );
                        Severity: Minor
                        Found in includes/Hooks.php - About 1 hr to fix

                          Function getThumbnail has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              mw.UploadWizardUpload.prototype.getThumbnail = function ( width, height ) {
                                  var upload = this,
                                      deferred = $.Deferred();
                          
                                  if ( this.thumbnailPromise[ width + 'x' + height ] ) {
                          Severity: Minor
                          Found in resources/mw.UploadWizardUpload.js - About 1 hr to fix

                            Function ajax has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                        api.ajax = function ( parameters, ajaxOptions ) {
                                            var original, override;
                            
                                            Object.assign( parameters, {
                                                errorformat: 'html',
                            Severity: Minor
                            Found in resources/mw.UploadWizard.js - About 1 hr to fix

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

                                      if ( this.aborted ) {
                                          return $.Deferred().reject( 'aborted', {
                                              errors: [ {
                                                  code: 'aborted',
                                                  html: mw.message( 'api-error-aborted' ).parse()
                              Severity: Major
                              Found in resources/transports/mw.FormDataTransport.js and 2 other locations - About 1 hr to fix
                              resources/transports/mw.FormDataTransport.js on lines 351..358
                              resources/transports/mw.FormDataTransport.js on lines 372..392

                              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 57.

                              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 3 locations. Consider refactoring.
                              Open

                                                  if ( ( Date.now() - transport.firstPoll ) > 10 * 60 * 1000 ) {
                                                      return $.Deferred().reject( 'server-error', { errors: [ {
                                                          code: 'server-error',
                                                          html: mw.message( 'api-clientside-error-timeout' ).parse()
                                                      } ] } );
                              Severity: Major
                              Found in resources/transports/mw.FormDataTransport.js and 2 other locations - About 1 hr to fix
                              resources/transports/mw.FormDataTransport.js on lines 199..206
                              resources/transports/mw.FormDataTransport.js on lines 351..358

                              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 57.

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language