wikimedia/mediawiki-extensions-UploadWizard

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

Summary

Maintainability
D
2 days
Test Coverage

Function addNextButton has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    uw.ui.Details.prototype.addNextButton = function () {
        var ui = this;

        this.nextButtonPromise.done( () => {
            ui.$buttons.append(
Severity: Minor
Found in resources/ui/steps/uw.ui.Details.js - About 1 hr to fix

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

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

                    this.$div.prepend(
                        $( '<div>' )
                            .addClass( 'mwe-upwiz-license-metadata ui-corner-all' )
                            .append(
                                $( '<h4>' ).text( mw.msg( 'mwe-upwiz-license-metadata-title' ) ),
        Severity: Major
        Found in resources/ui/steps/uw.ui.Details.js and 1 other location - About 3 hrs to fix
        resources/ui/steps/uw.ui.Metadata.js on lines 79..89

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

        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

                    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.Details.js and 1 other location - About 3 hrs to fix
        resources/ui/steps/uw.ui.Upload.js on lines 363..377

        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.Details.js and 2 other locations - About 3 hrs to fix
        resources/ui/steps/uw.ui.Upload.js on lines 348..361
        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

                $errorElements.each( function () {
                    var $collapsibleWrapper = $( this ).closest( '.mwe-more-details' );
                    if ( $collapsibleWrapper.length ) {
                        $collapsibleWrapper.data( 'mw-collapsible' ).expand();
                    }
        Severity: Major
        Found in resources/ui/steps/uw.ui.Details.js and 1 other location - About 1 hr to fix
        resources/ui/steps/uw.ui.Details.js on lines 237..242

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

        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

                $warningElements.each( function () {
                    var $collapsibleWrapper = $( this ).closest( '.mwe-more-details' );
                    if ( $collapsibleWrapper.length ) {
                        $collapsibleWrapper.data( 'mw-collapsible' ).expand();
                    }
        Severity: Major
        Found in resources/ui/steps/uw.ui.Details.js and 1 other location - About 1 hr to fix
        resources/ui/steps/uw.ui.Details.js on lines 202..207

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

        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-details' ).text(),
                    flags: [ 'progressive', 'primary' ]
                } ).on( 'click', startDetails );
        Severity: Major
        Found in resources/ui/steps/uw.ui.Details.js and 2 other locations - About 1 hr to fix
        resources/ui/steps/uw.ui.Details.js on lines 54..57
        resources/ui/steps/uw.ui.Details.js on lines 59..62

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

        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.retryButtonSomeFailed = new OO.ui.ButtonWidget( {
                    label: mw.message( 'mwe-upwiz-file-retry' ).text(),
                    flags: [ 'progressive', 'primary' ]
                } ).on( 'click', startDetails );
        Severity: Major
        Found in resources/ui/steps/uw.ui.Details.js and 2 other locations - About 1 hr to fix
        resources/ui/steps/uw.ui.Details.js on lines 42..45
        resources/ui/steps/uw.ui.Details.js on lines 59..62

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

        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.retryButtonAllFailed = new OO.ui.ButtonWidget( {
                    label: mw.message( 'mwe-upwiz-file-retry' ).text(),
                    flags: [ 'progressive', 'primary' ]
                } ).on( 'click', startDetails );
        Severity: Major
        Found in resources/ui/steps/uw.ui.Details.js and 2 other locations - About 1 hr to fix
        resources/ui/steps/uw.ui.Details.js on lines 42..45
        resources/ui/steps/uw.ui.Details.js on lines 54..57

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

        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

                    $( 'html, body' ).animate( { scrollTop: $( $warningElements[ 0 ] ).offset().top - 50 }, 'slow' );
        Severity: Minor
        Found in resources/ui/steps/uw.ui.Details.js and 1 other location - About 40 mins to fix
        resources/ui/steps/uw.ui.Details.js on lines 220..220

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

        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

                    $( 'html, body' ).animate( { scrollTop: $( $errorElements[ 0 ] ).offset().top - 50 }, 'slow' );
        Severity: Minor
        Found in resources/ui/steps/uw.ui.Details.js and 1 other location - About 40 mins to fix
        resources/ui/steps/uw.ui.Details.js on lines 251..251

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

        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