wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 141 of 272 total issues

Function UWUIDetails has 33 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 initialize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        uw.PatentDialog.prototype.initialize = function () {
            var filenames = [],
                label = new OO.ui.LabelWidget(),
                panels = new OO.ui.PanelLayout( { padded: true, expanded: false } );
    
    
    Severity: Minor
    Found in resources/deed/dialog/uw.deed.dialog.PatentDialog.js - About 1 hr to fix

      Function load has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          uw.ui.Details.prototype.load = function ( uploads ) {
              uw.ui.Step.prototype.load.call( this, uploads );
      
              if ( mw.UploadWizard.config.wikibase.enabled && mw.UploadWizard.config.wikibase.captions ) {
                  this.$div.prepend(
      Severity: Minor
      Found in resources/ui/steps/uw.ui.Details.js - About 1 hr to fix

        Function getStashImageInfo has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            mw.UploadWizardUpload.prototype.getStashImageInfo = function ( callback, props, width, height ) {
                var params = {
                    prop: 'stashimageinfo',
                    siifilekey: this.fileKey,
                    siiprop: props.join( '|' )
        Severity: Minor
        Found in resources/mw.UploadWizardUpload.js - About 1 hr to fix

          Function getApi has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  getApi: function ( options ) {
                      var api = new mw.Api( options );
          
                      api.ajax = function ( parameters, ajaxOptions ) {
                          var original, override;
          Severity: Minor
          Found in resources/mw.UploadWizard.js - About 1 hr to fix

            Function setValues has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                setValues: function ( values, groupName ) {
                    var selectedGroups = [];
            
                    var input = this;
                    this.getItems().forEach( ( group ) => {
            Severity: Minor
            Found in resources/mw.UploadWizardLicenseInput.js - About 1 hr to fix

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

                  public function execute( $subPage ) {
                      // side effects: if we can't upload, will print error page to wgOut
                      // and return false
                      if ( !( $this->isUploadAllowed() && $this->isUserUploadAllowed( $this->getUser() ) ) ) {
                          return;
              Severity: Minor
              Found in includes/Specials/SpecialUploadWizard.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 UploadWizardLicenseInput has a Cognitive Complexity of 11 (exceeds 5 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: Minor
              Found in resources/mw.UploadWizardLicenseInput.js - 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 UWUITutorial has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  uw.ui.Tutorial = function UWUITutorial() {
                      var ui = this;
              
                      uw.ui.Step.call(
                          this,
              Severity: Minor
              Found in resources/ui/steps/uw.ui.Tutorial.js - About 1 hr to fix

                Function UWDeedInterface has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    uw.deed.Abstract = function UWDeedInterface( name, config, uploads ) {
                        var tcName, details, field, input;
                        this.name = name;
                        this.config = config;
                        uw.deed.Abstract.prototype.instanceCount++;
                Severity: Minor
                Found in resources/deed/uw.deed.Abstract.js - About 1 hr to fix

                  Function getWikiText has 31 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 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

                      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 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 setImageURL has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              setImageURL: function ( index ) {
                                  var upload = this.imageUploads[ index ];
                                  var photoId = upload.photoId;
                                  var checker = this;
                          
                          
                          Severity: Minor
                          Found in resources/mw.FlickrChecker.js - About 1 hr to fix

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

                                uw.MetadataContent.prototype.applyCopiedStatements = function ( statementWidgets ) {
                                    var self = this;
                            
                                    // 1. remove all existing statementWidgets
                                    Object.keys( this.statementWidgets ).forEach( ( propId ) => {
                            Severity: Minor
                            Found in resources/metadata/uw.MetadataContent.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 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 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

                                    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 = $.extend( {}, localDuplicates, foreignDuplicates ),
                                                $extra = $( '<div>' ),
                                                $ul = $( '<ul>' ).appendTo( $extra ),
                                                $a,
                                    Severity: Minor
                                    Found in resources/handlers/mw.ApiUploadHandler.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language