wikimedia/mediawiki-extensions-UploadWizard

View on GitHub
resources/ui/steps/uw.ui.Upload.js

Summary

Maintainability
F
4 days
Test Coverage

Function UWUIUpload has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    uw.ui.Upload = function UWUIUpload( config ) {
        var upload = this;

        this.config = config;

Severity: Major
Found in resources/ui/steps/uw.ui.Upload.js - About 5 hrs to fix

    File uw.ui.Upload.js has 368 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * This file is part of the MediaWiki extension UploadWizard.
     *
     * UploadWizard is free software: you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
    Severity: Minor
    Found in resources/ui/steps/uw.ui.Upload.js - About 4 hrs to fix

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

            uw.ui.Upload.prototype.updateFileCounts = function ( haveUploads, fewerThanMax ) {
                this.$fileList.toggleClass( 'mwe-upwiz-filled-filelist', haveUploads );
                this.$addFileContainer.toggleClass( 'mwe-upwiz-add-files-0', !haveUploads );
        
                this.setAddButtonText( haveUploads );
        Severity: Minor
        Found in resources/ui/steps/uw.ui.Upload.js - About 1 hr to fix

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

              uw.ui.Upload.prototype.load = function ( uploads ) {
                  uw.ui.Step.prototype.load.call( this, uploads );
          
                  if ( uploads.length === 0 ) {
                      this.$fileList.removeClass( 'mwe-upwiz-filled-filelist' );
          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

                        ui.$buttons.append(
                            $( '<div>' )
                                .addClass( 'mwe-upwiz-file-next-some-failed mwe-upwiz-file-endchoice' )
                                .append(
                                    new OO.ui.HorizontalLayout( {
            Severity: Major
            Found in resources/ui/steps/uw.ui.Upload.js and 1 other location - About 3 hrs to fix
            resources/ui/steps/uw.ui.Details.js on lines 124..138

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

            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

                        ui.$buttons.append(
                            $( '<div>' )
                                .addClass( 'mwe-upwiz-file-next-all-failed mwe-upwiz-file-endchoice' )
                                .append(
                                    new OO.ui.HorizontalLayout( {
            Severity: Major
            Found in resources/ui/steps/uw.ui.Upload.js and 2 other locations - About 3 hrs to fix
            resources/ui/steps/uw.ui.Details.js on lines 140..153
            resources/ui/steps/uw.ui.Upload.js on lines 348..361

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

            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

                        ui.$buttons.append(
                            $( '<div>' )
                                .addClass( 'mwe-upwiz-file-next-all-ok mwe-upwiz-file-endchoice' )
                                .append(
                                    new OO.ui.HorizontalLayout( {
            Severity: Major
            Found in resources/ui/steps/uw.ui.Upload.js and 2 other locations - About 3 hrs to fix
            resources/ui/steps/uw.ui.Details.js on lines 140..153
            resources/ui/steps/uw.ui.Upload.js on lines 379..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 97.

            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

                    this.retryButtonAllFailed = new OO.ui.ButtonWidget( {
                        label: mw.message( 'mwe-upwiz-file-retry' ).text(),
                        flags: [ 'progressive' ]
                    } ).on( 'click', () => {
                        upload.hideEndButtons();
            Severity: Major
            Found in resources/ui/steps/uw.ui.Upload.js and 1 other location - About 2 hrs to fix
            resources/ui/steps/uw.ui.Upload.js on lines 158..164

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

            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

                    this.retryButtonSomeFailed = new OO.ui.ButtonWidget( {
                        label: mw.message( 'mwe-upwiz-file-retry' ).text(),
                        flags: [ 'progressive' ]
                    } ).on( 'click', () => {
                        upload.hideEndButtons();
            Severity: Major
            Found in resources/ui/steps/uw.ui.Upload.js and 1 other location - About 2 hrs to fix
            resources/ui/steps/uw.ui.Upload.js on lines 173..179

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

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

            There are no issues that match your filters.

            Category
            Status