wikimedia/mediawiki-extensions-UniversalLanguageSelector

View on GitHub

Showing 269 of 269 total issues

Method onBeforePageDisplay has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function onBeforePageDisplay( $out, $skin ): void {
        $unsupportedSkins = [ 'minerva', 'apioutput' ];
        if ( in_array( $skin->getSkinName(), $unsupportedSkins, true ) ) {
            return;
        }
Severity: Minor
Found in includes/Hooks.php - About 1 hr to fix

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

            close: function () {
                if ( !this.shown ) {
                    return;
                }
    
    
    Severity: Major
    Found in resources/js/ext.uls.languagesettings.js and 1 other location - About 1 hr to fix
    resources/js/ext.uls.actions.menu.js on lines 97..108

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

    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

            close: function () {
                if ( !this.shown ) {
                    return;
                }
    
    
    Severity: Major
    Found in resources/js/ext.uls.actions.menu.js and 1 other location - About 1 hr to fix
    resources/js/ext.uls.languagesettings.js on lines 267..279

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

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

            apply: function () {
                if ( !this.dirty ) {
                    // No changes to save in this module.
                    return;
                }
    Severity: Minor
    Found in resources/js/ext.uls.displaysettings.js - About 1 hr to fix

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

              var clickHandler = function ( e ) {
                  var languagesettings = $trigger.data( 'languagesettings' ),
                      languageSettingsOptions;
      
                  if ( languagesettings ) {
      Severity: Minor
      Found in resources/js/ext.uls.interface.js - About 1 hr to fix

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

                keypress: function ( e ) {
                    var suggestion, query;
        
                    switch ( e.keyCode ) {
                        case 9: // Tab -> Autocomplete
        Severity: Minor
        Found in lib/jquery.uls/src/jquery.uls.languagefilter.js - About 1 hr to fix

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

                  prepareFontSelector: function ( target ) {
                      var language, fonts, $fontSelector, savedFont,
                          $systemFont, $fontLabel, $fontsSection;
          
                      // Get the language code from the right property -
          Severity: Minor
          Found in resources/js/ext.uls.displaysettings.js - About 1 hr to fix

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

                mw.webfonts.setup = function () {
                    // Initialize webfonts
                    var mediawikiFontRepository = $.webfonts.repository;
            
                    mediawikiFontRepository.base = mw.config.get( 'wgULSFontRepositoryBasePath' );
            Severity: Minor
            Found in resources/js/ext.uls.webfonts.js - About 1 hr to fix

              Function initModule has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      initModule: function ( moduleName, active ) {
                          var $settingsTitle, $settingsText, $settingsLink,
                              languageSettings = this,
                              module = new $.fn.languagesettings.modules[ moduleName ]( languageSettings ),
                              $settingsMenuItems = languageSettings.$window.find( '.settings-menu-items' );
              Severity: Minor
              Found in resources/js/ext.uls.languagesettings.js - About 1 hr to fix

                Function prepareLanguageList has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        prepareLanguageList: function () {
                            var languageCodeIndex,
                                $languageListWrapper,
                                $languageList,
                                languageList,
                Severity: Minor
                Found in lib/jquery.ime/jquery.ime.js - About 1 hr to fix

                  Function keypress has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          keypress: function ( e ) {
                              var altGr = false,
                                  c, input, replacement;
                  
                              if ( !this.active ) {
                  Severity: Minor
                  Found in lib/jquery.ime/jquery.ime.js - About 1 hr to fix

                    Function replaceTextAtSelection has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        ContentEditableEntry.prototype.replaceTextAtSelection = function (
                            precedingCharCount,
                            newText
                        ) {
                            var textNode, textOffset, newOffset, newRange,
                    Severity: Minor
                    Found in lib/jquery.ime/jquery.ime.js - About 1 hr to fix

                      Function addRange has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                      selProto.addRange = function(range, direction) {
                                          if (implementsControlRange && implementsDocSelection && this.docSelection.type == CONTROL) {
                                              addRangeToControlSelection(this, range);
                                          } else {
                                              if (isDirectionBackward(direction) && selectionHasExtend) {
                      Severity: Minor
                      Found in lib/rangy/rangy-core.js - About 1 hr to fix

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

                                patterns_x: [
                                    [ 'F', '\u090C' ],
                                    [ 'N', '\u0933' ],
                                    [ '\\>', '\u093D' ],
                                    [ '\\=', '\u0944' ],
                        Severity: Major
                        Found in lib/jquery.ime/rules/brx/brx-inscript.js and 2 other locations - About 1 hr to fix
                        lib/jquery.ime/rules/ff/ff-tilde.js on lines 13..28
                        lib/jquery.ime/rules/kn/kn-inscript2.js on lines 100..115

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

                        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

                                patterns: [
                                    [ '~b', 'ɓ' ],
                                    [ '~B', 'Ɓ' ],
                                    [ '~d', 'ɗ' ],
                                    [ '~D', 'Ɗ' ],
                        Severity: Major
                        Found in lib/jquery.ime/rules/ff/ff-tilde.js and 2 other locations - About 1 hr to fix
                        lib/jquery.ime/rules/brx/brx-inscript.js on lines 94..108
                        lib/jquery.ime/rules/kn/kn-inscript2.js on lines 100..115

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

                        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

                                patterns_x: [
                                    [ '1', '\u200d' ],
                                    [ '2', '\u200c' ],
                                    [ '4', '₹' ],
                                    [ '\\+', 'ೠ' ],
                        Severity: Major
                        Found in lib/jquery.ime/rules/kn/kn-inscript2.js and 2 other locations - About 1 hr to fix
                        lib/jquery.ime/rules/brx/brx-inscript.js on lines 94..108
                        lib/jquery.ime/rules/ff/ff-tilde.js on lines 13..28

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

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

                                keydown: function ( e ) {
                                    var ime = $( e.target ).data( 'ime' ),
                                        firstInputmethod,
                                        previousInputMethods,
                                        languageCode;
                        Severity: Minor
                        Found in lib/jquery.ime/jquery.ime.js - About 1 hr to fix

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

                              function addActionsMenuTriggers( uls ) {
                                  var $ulsSettingsBlock = addLanguageSettingsTrigger( uls );
                          
                                  var actionItemsRegistry = mw.uls.ActionsMenuItemsRegistry;
                                  actionItemsRegistry.on( 'register', onActionItemAdded );
                          Severity: Minor
                          Found in resources/js/ext.uls.interface.js - About 1 hr to fix

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

                                    render: function () {
                                        var $section,
                                            $quicklist = this.buildQuicklist(),
                                            regions = [],
                                            regionNames = {
                            Severity: Minor
                            Found in lib/jquery.uls/src/jquery.uls.lcd.js - About 1 hr to fix

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

                                      transliterate: function ( input, context, altGr ) {
                                          var patterns, regex, contextRegex, rule, replacement, i, retval;
                              
                                          if ( altGr ) {
                                              patterns = this.inputmethod.patterns_x || [];
                              Severity: Minor
                              Found in lib/jquery.ime/jquery.ime.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language