wikimedia/mediawiki-extensions-UniversalLanguageSelector

View on GitHub

Showing 108 of 269 total issues

Function 1 has 7068 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    1: [ function ( require, module, exports ) {
        module.exports = ( function ( $ ) {
            $.uls = $.uls || {};
            $.uls.data =
{
Severity: Major
Found in lib/jquery.uls/src/jquery.uls.data.js - About 1 mo to fix

    Function exports has 7066 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            module.exports = ( function ( $ ) {
                $.uls = $.uls || {};
                $.uls.data =
    {
        "languages": {
    Severity: Major
    Found in lib/jquery.uls/src/jquery.uls.data.js - About 1 mo to fix

      File jquery.uls.data.js has 7072 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      ( function () { function r( e, n, t ) { function o( i, f ) { if ( !n[ i ] ) { if ( !e[ i ] ) { var c = typeof require === 'function' && require; if ( !f && c ) { return c( i, !0 ); } if ( u ) { return u( i, !0 ); } var a = new Error( "Cannot find module '" + i + "'" ); throw a.code = 'MODULE_NOT_FOUND', a; } var p = n[ i ] = { exports: {} }; e[ i ][ 0 ].call( p.exports, function ( r ) { var n = e[ i ][ 1 ][ r ]; return o( n || r ); }, p, p.exports, r, e, n, t ); } return n[ i ].exports; } for ( var u = typeof require === 'function' && require, i = 0; i < t.length; i++ ) { o( t[ i ] ); } return o; } return r; }() )( {
          1: [ function ( require, module, exports ) {
              module.exports = ( function ( $ ) {
                  $.uls = $.uls || {};
                  $.uls.data =
      Severity: Major
      Found in lib/jquery.uls/src/jquery.uls.data.js - About 2 wks to fix

        File rangy-core.js has 2914 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * Rangy, a cross-browser JavaScript range and selection library
         * https://github.com/timdown/rangy
         *
         * Copyright 2015, Tim Down
        Severity: Major
        Found in lib/rangy/rangy-core.js - About 1 wk to fix

          File jquery.ime.js has 2597 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*! jquery.ime - v0.2.0+20240422
          * https://github.com/wikimedia/jquery.ime
          * Copyright (c) 2024 Santhosh Thottingal; License: (GPL-2.0-or-later OR MIT) */
          ( function ( $ ) {
              'use strict';
          Severity: Major
          Found in lib/jquery.ime/jquery.ime.js - About 1 wk to fix

            File ext.uls.webfonts.repository.js has 828 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Do not edit! This file is generated from data/fontrepo by scripts/compile-font-repo.php
            ( function () {
                $.webfonts = $.webfonts || {};
                $.webfonts.repository = {
                "base": "../data/fontrepo/fonts/",
            Severity: Major
            Found in resources/js/ext.uls.webfonts.repository.js - About 1 day to fix

              Function createPrototypeRange has 195 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function createPrototypeRange(constructor, boundaryUpdater) {
                          function createBeforeAfterNodeSetter(isBefore, isStart) {
                              return function(node) {
                                  assertValidNodeType(node, beforeAfterNodeTypes);
                                  assertValidNodeType(getRootContainer(node), rootContainerNodeTypes);
              Severity: Major
              Found in lib/rangy/rangy-core.js - About 7 hrs to fix

                File ext.uls.interface.js has 467 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*!
                 * ULS interface integration logic
                 *
                 * Copyright (C) 2012-2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
                 * Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
                Severity: Minor
                Found in resources/js/ext.uls.interface.js - About 7 hrs to fix

                  File ext.uls.displaysettings.js has 451 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /*!
                   * ULS-based display settings panel
                   *
                   * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
                   * Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
                  Severity: Minor
                  Found in resources/js/ext.uls.displaysettings.js - About 6 hrs to fix

                    Function ULSDialog has 143 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        var ULSDialog = function ( options ) {
                            var $dialog = options.container,
                                hasOverlay = options.hasOverlay,
                                $overlay,
                                // Source: https://github.com/ghosh/Micromodal/blob/master/lib/src/index.js#L4
                    Severity: Major
                    Found in resources/js/ext.uls.dialog.js - About 5 hrs to fix

                      File ext.uls.inputsettings.js has 380 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*!
                       * ULS-based ime settings panel
                       *
                       * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
                       * Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
                      Severity: Minor
                      Found in resources/js/ext.uls.inputsettings.js - About 5 hrs to fix

                        File jquery.uls.lcd.js has 376 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /**
                         * Universal Language Selector
                         * Language category display component - Used for showing the search results,
                         * grouped by regions, scripts
                         *
                        Severity: Minor
                        Found in lib/jquery.uls/src/jquery.uls.lcd.js - About 5 hrs to fix

                          File am-transliteration.js has 374 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          ( function ( $ ) {
                              'use strict';
                          
                              var amTransliteration = {
                                  id: 'am-transliteration',
                          Severity: Minor
                          Found in lib/jquery.ime/rules/am/am-transliteration.js - About 5 hrs to fix

                            File tig-geezim.js has 366 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            ( function ( $ ) {
                                'use strict';
                            
                                var tigGeezim = {
                                    id: 'tig-geezim',
                            Severity: Minor
                            Found in lib/jquery.ime/rules/tig/tig-geezim.js - About 4 hrs to fix

                              File byn-geezim.js has 366 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              ( function ( $ ) {
                                  'use strict';
                              
                                  var bynGeezim = {
                                      id: 'byn-geezim',
                              Severity: Minor
                              Found in lib/jquery.ime/rules/byn/byn-geezim.js - About 4 hrs to fix

                                File ti-geezim.js has 366 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                ( function ( $ ) {
                                    'use strict';
                                
                                    var tiGeezim = {
                                        id: 'ti-geezim',
                                Severity: Minor
                                Found in lib/jquery.ime/rules/ti/ti-geezim.js - About 4 hrs to fix

                                  Function search has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public static function search( $searchKey, $typos = 0, $userLanguage = null ) {
                                          $results = [];
                                          $searchKey = mb_strtolower( $searchKey );
                                  
                                          if ( mb_strlen( $searchKey ) > 100 ) {
                                  Severity: Minor
                                  Found in data/LanguageNameSearch.php - About 4 hrs to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  File Hooks.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  /**
                                   * Hooks for UniversalLanguageSelector extension.
                                   *
                                   * Copyright (C) 2012-2018 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon
                                  Severity: Minor
                                  Found in includes/Hooks.php - About 4 hrs to fix

                                    File ml-transliteration.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    ( function ( $ ) {
                                        'use strict';
                                    
                                        var mltransliteration = {
                                            id: 'ml-transliteration',
                                    Severity: Minor
                                    Found in lib/jquery.ime/rules/ml/ml-transliteration.js - About 4 hrs to fix

                                      Function execute has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function execute() {
                                              global $wgExtraLanguageNames;
                                      
                                              // Avoid local configuration leaking to this script
                                              if ( $wgExtraLanguageNames !== [] ) {
                                      Severity: Minor
                                      Found in data/LanguageNameIndexer.php - About 3 hrs to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language