wikimedia/mediawiki-extensions-Translate

View on GitHub
resources/js/ext.translate.special.managetranslatorsandbox.js

Summary

Maintainability
F
5 days
Test Coverage

File ext.translate.special.managetranslatorsandbox.js has 558 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * JS for special page.
 * @author Niklas Laxström
 * @author Sucheta Ghoshal
 * @author Amir E. Aharoni
Severity: Major
Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 1 day to fix

    Function displayRequestDetails has 105 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function displayRequestDetails( request ) {
            var $reminderStatus = $( '<span>' ).addClass( 'reminder-status' ),
                $detailsPane = $( '.details.pane' );
            if ( request.reminderscount ) {
                var agoText = moment.isMoment( request.lastreminder ) ? moment( request.lastreminder ).fromNow() : request.lastreminder;
    Severity: Major
    Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 4 hrs to fix

      Function displayOnMultipleSelection has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function displayOnMultipleSelection() {
              var selectedUserIDs = $( '.request-selector:checked' ).map( function ( i, checkedBox ) {
                  return $( checkedBox ).parents( 'div.request' ).data( 'data' ).userid;
              } ).toArray();
      
      
      Severity: Minor
      Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 1 hr to fix

        Function requestSelectHandler has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function requestSelectHandler( e ) {
                var request = e.target,
                    $detailsPane = $( '.details.pane' ),
                    $requestCheckboxes = $( '.request-selector' ),
                    $selectAll = $( '.request-selector-all' ),
        Severity: Minor
        Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 1 hr to fix

          Function showTranslation has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function showTranslation( translation ) {
                  var $target = $( '.translations' ),
                      translationLang = translation.title.split( '/' ).pop();
          
                  $target.append( $( '<div>' )
          Severity: Minor
          Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 1 hr to fix

            Function init has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                LanguageFilter.prototype.init = function () {
                    var languageFilter = this;
            
                    var $clearButton = $( '<button>' )
                        .addClass( 'clear-language-selector hide' )
            Severity: Minor
            Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 1 hr to fix

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

                  function showTranslations( translations ) {
                      var $target = $( '.translations' );
              
                      $target.empty();
              
              
              Severity: Minor
              Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 1 hr to fix

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

                                    $( '<button>' )
                                        .addClass( 'accept mw-ui-button mw-ui-progressive' )
                                        .text( mw.msg( 'tsb-accept-button-label' ) )
                                        .on( 'click', function () {
                                            mw.notify( mw.msg( 'tsb-accept-confirmation', 1 ) );
                resources/js/ext.translate.special.managetranslatorsandbox.js on lines 137..153

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

                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

                                    $( '<button>' )
                                        .addClass( 'reject mw-ui-button mw-ui-destructive' )
                                        .text( mw.msg( 'tsb-reject-button-label' ) )
                                        .on( 'click', function () {
                                            mw.notify( mw.msg( 'tsb-reject-confirmation', 1 ) );
                resources/js/ext.translate.special.managetranslatorsandbox.js on lines 120..136

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

                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

                                    $( '<button>' )
                                        .addClass( 'accept-all mw-ui-button mw-ui-progressive' )
                                        .text( mw.msg( 'tsb-accept-all-button-label' ) )
                                        .on( 'click', function () {
                                            mw.notify( mw.msg( 'tsb-accept-confirmation', selectedUserIDs.length ) );
                resources/js/ext.translate.special.managetranslatorsandbox.js on lines 314..330

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

                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

                                    $( '<button>' )
                                        .addClass( 'reject-all mw-ui-button mw-ui-destructive' )
                                        .text( mw.msg( 'tsb-reject-all-button-label' ) )
                                        .on( 'click', function () {
                                            mw.notify( mw.msg( 'tsb-reject-confirmation', selectedUserIDs.length ) );
                resources/js/ext.translate.special.managetranslatorsandbox.js on lines 297..313

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

                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

                    $.fn.translatorSearch = function () {
                        return this.each( function () {
                            if ( !$.data( this, 'TranslatorSearch' ) ) {
                                $.data( this, 'TranslatorSearch', new TranslatorSearch( this ) );
                            }
                resources/js/ext.translate.special.managetranslatorsandbox.js on lines 651..657

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

                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

                    $.fn.languageFilter = function () {
                        return this.each( function () {
                            if ( !$.data( this, 'LanguageFilter' ) ) {
                                $.data( this, 'LanguageFilter', new LanguageFilter( this ) );
                            }
                resources/js/ext.translate.special.managetranslatorsandbox.js on lines 721..727

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

                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

                    delay = ( function () {
                        var timer = 0;
                
                        return function ( callback, milliseconds ) {
                            clearTimeout( timer );
                Severity: Minor
                Found in resources/js/ext.translate.special.managetranslatorsandbox.js and 1 other location - About 50 mins to fix
                resources/src/ext.translate.groupselector/index.js on lines 700..707

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

                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