wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 272 of 272 total issues

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

        this.nextButton = new OO.ui.ButtonWidget( {
            classes: [ 'mwe-upwiz-button-next' ],
            label: mw.message( 'mwe-upwiz-next' ).text(),
            flags: [ 'progressive', 'primary' ]
        } ).on( 'click', () => {
Severity: Major
Found in resources/ui/steps/uw.ui.Tutorial.js and 1 other location - About 2 hrs to fix
resources/ui/uw.ui.Step.js on lines 93..99

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

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

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

        this.nextButton = new OO.ui.ButtonWidget( {
            classes: [ 'mwe-upwiz-button-next' ],
            label: mw.message( 'mwe-upwiz-next' ).text(),
            flags: [ 'progressive', 'primary' ]
        } ).on( 'click', () => {
Severity: Major
Found in resources/ui/uw.ui.Step.js and 1 other location - About 2 hrs to fix
resources/ui/steps/uw.ui.Tutorial.js on lines 122..128

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

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

        getWarnings: function () {
            return $.when.apply( $, this.getAllFields().map( ( fieldLayout ) => {
                // return warnings if field has them, empty array (no warnings) otherwise
                if ( fieldLayout.fieldWidget.getWarnings ) {
                    return fieldLayout.fieldWidget.getWarnings();
Severity: Major
Found in resources/mw.UploadWizardDetails.js and 1 other location - About 2 hrs to fix
resources/mw.UploadWizardDetails.js on lines 464..472

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

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 ( this.config.minLength && length < this.config.minLength ) {
            errors.push( mw.message( 'mwe-upwiz-error-title-too-short', this.config.minLength ) );
            return $.Deferred().resolve( errors ).promise();
        }
Severity: Major
Found in resources/details/uw.TitleDetailsWidget.js and 1 other location - About 2 hrs to fix
resources/details/uw.TitleDetailsWidget.js on lines 123..126

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

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

        getErrors: function () {
            return $.when.apply( $, this.getAllFields().map( ( fieldLayout ) => {
                // return errors if field has them, empty array (no errors) otherwise
                if ( fieldLayout.fieldWidget.getErrors ) {
                    return fieldLayout.fieldWidget.getErrors();
Severity: Major
Found in resources/mw.UploadWizardDetails.js and 1 other location - About 2 hrs to fix
resources/mw.UploadWizardDetails.js on lines 479..487

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

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 ( this.config.maxLength && length > this.config.maxLength ) {
            errors.push( mw.message( 'mwe-upwiz-error-title-too-long', this.config.maxLength ) );
            return $.Deferred().resolve( errors ).promise();
        }
Severity: Major
Found in resources/details/uw.TitleDetailsWidget.js and 1 other location - About 2 hrs to fix
resources/details/uw.TitleDetailsWidget.js on lines 118..121

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

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

    mw.UploadWizardDeedChooser = function ( config, deeds, uploads ) {
        var chooser = this,
            $radioContainer,
            $formContainer;

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

    Function UWCopyMetadataWidget has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        uw.CopyMetadataWidget = function UWCopyMetadataWidget( config ) {
            var metadataType, defaultStatus, copyMetadataMsg,
                checkboxes = [],
                $copyMetadataWrapperDiv = $( '<div>' ),
                $copyMetadataDiv = $( '<div>' );
    Severity: Major
    Found in resources/uw.CopyMetadataWidget.js - About 2 hrs to fix

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

              showIndicator: function ( status ) {
                  var progress = status === 'progress';
                  this.$spinner.toggle( progress );
                  this.statusMessage.toggle( status && !progress ).setType( status );
                  this.$indicator.toggleClass( 'mwe-upwiz-file-indicator-visible', !!status );
      Severity: Major
      Found in resources/mw.UploadWizardDetails.js and 1 other location - About 2 hrs to fix
      resources/mw.UploadWizardUploadInterface.js on lines 89..94

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

      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

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

          mw.UploadWizardUploadInterface.prototype.showIndicator = function ( status ) {
              var progress = status === 'progress';
              this.$spinner.toggle( progress );
              this.statusMessage.toggle( status && !progress ).setType( status );
              this.$indicator.toggleClass( 'mwe-upwiz-file-indicator-visible', !!status );
      Severity: Major
      Found in resources/mw.UploadWizardUploadInterface.js and 1 other location - About 2 hrs to fix
      resources/mw.UploadWizardDetails.js on lines 1402..1407

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

      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

      Campaign has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Campaign {
      
          /**
           * The campaign configuration.
           *
      Severity: Minor
      Found in includes/Campaign.php - About 2 hrs to fix

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

            public function execute() {
                $params = $this->extractRequestParams();
        
                $limit = $params['limit'];
        
        
        Severity: Major
        Found in includes/ApiQueryAllCampaigns.php - About 2 hrs to fix

          Function getTransformedCanvasElement has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              mw.UploadWizardUpload.prototype.getTransformedCanvasElement = function ( image, constraints ) {
                  var angle, scaling, width, height,
                      dimensions, dx, dy, x, y, $canvas, ctx,
                      scaleConstraints = constraints,
                      rotation = 0;
          Severity: Major
          Found in resources/mw.UploadWizardUpload.js - About 2 hrs to fix

            Method execute has 54 lines of code (exceeds 25 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: Major
            Found in includes/Specials/SpecialUploadWizard.php - About 2 hrs to fix

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

                      this.nextStepButtonSomeFailed = new OO.ui.ButtonWidget( {
                          label: mw.message( 'mwe-upwiz-next-file-despite-failures' ).text(),
                          flags: [ 'progressive', 'primary' ]
                      } ).on( 'click', () => {
                          upload.emit( 'next-step' );
              Severity: Major
              Found in resources/ui/steps/uw.ui.Upload.js and 2 other locations - About 2 hrs to fix
              resources/ui/steps/uw.ui.Metadata.js on lines 33..38
              resources/ui/steps/uw.ui.Upload.js on lines 151..156

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

              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

                      var filename = mw.Title.makeTitle( NS_FILE, duplicate ).getPrefixedText(),
                          uploadDuplicate = this.makeOverrideButton().on( 'click', () => {
                              // mark this warning as ignored & process the API result again
                              this.ignoreWarning( 'duplicate-archive' );
                              this.setTransported( result );
              Severity: Major
              Found in resources/handlers/mw.ApiUploadHandler.js and 1 other location - About 2 hrs to fix
              resources/handlers/mw.ApiUploadHandler.js on lines 279..284

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

              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

                      this.nextButton = new OO.ui.ButtonWidget( {
                          label: mw.message( 'mwe-upwiz-publish-metadata' ).text(),
                          flags: [ 'progressive', 'primary' ]
                      } ).on( 'click', () => {
                          self.emit( 'submit' );
              Severity: Major
              Found in resources/ui/steps/uw.ui.Metadata.js and 2 other locations - About 2 hrs to fix
              resources/ui/steps/uw.ui.Upload.js on lines 151..156
              resources/ui/steps/uw.ui.Upload.js on lines 166..171

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

              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

                      var filename = mw.Title.makeTitle( NS_FILE, duplicate ).getPrefixedText(),
                          uploadDuplicate = this.makeOverrideButton().on( 'click', () => {
                              // mark this warning as ignored & process the API result again
                              this.ignoreWarning( 'duplicateversions' );
                              this.setTransported( result );
              Severity: Major
              Found in resources/handlers/mw.ApiUploadHandler.js and 1 other location - About 2 hrs to fix
              resources/handlers/mw.ApiUploadHandler.js on lines 295..300

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

              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

                      this.nextStepButtonAllOk = new OO.ui.ButtonWidget( {
                          label: mw.message( 'mwe-upwiz-next-file' ).text(),
                          flags: [ 'progressive', 'primary' ]
                      } ).on( 'click', () => {
                          upload.emit( 'next-step' );
              Severity: Major
              Found in resources/ui/steps/uw.ui.Upload.js and 2 other locations - About 2 hrs to fix
              resources/ui/steps/uw.ui.Metadata.js on lines 33..38
              resources/ui/steps/uw.ui.Upload.js on lines 166..171

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

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

                  private function getConfigForJSON( $campaign, $oldConfig ) {
                      $config = [
                          'enabled' => $campaign->campaign_enabled === '1',
                          'display' => [
                              'headerLabelPage' => $oldConfig['headerLabelPage'],
              Severity: Major
              Found in maintenance/migrateCampaigns.php - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language