wikimedia/mediawiki-extensions-UniversalLanguageSelector

View on GitHub

Showing 269 of 269 total issues

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

        patterns_x: [
            [ 'E', 'Ɛ' ],
            [ 'e', 'ɛ' ],
            // Both G and Y were requested by editors for Ɣ
            [ 'G', 'Ɣ' ],
Severity: Major
Found in lib/jquery.ime/rules/dag/dag-alt.js and 1 other location - About 1 hr to fix
lib/jquery.ime/rules/dag/dag-tilde.js on lines 14..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 56.

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

        createLanguageFilter: function () {
            var lcd, languagesCount,
                columnsOptions = {
                    wide: 4,
                    medium: 2,
Severity: Minor
Found in lib/jquery.uls/src/jquery.uls.core.js - About 1 hr to fix

    Function autofill has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            autofill: function ( langCode, languageName ) {
                var autonym, userInput, suggestion;
    
                if ( !this.$suggestion.length ) {
                    return;
    Severity: Minor
    Found in lib/jquery.uls/src/jquery.uls.languagefilter.js - About 1 hr to fix

      Function moveToBookmark has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  moveToBookmark: function(bookmark) {
                      var containerNode = bookmark.containerNode;
                      var charIndex = 0;
                      this.setStart(containerNode, 0);
                      this.collapse(true);
      Severity: Minor
      Found in lib/rangy/rangy-core.js - About 1 hr to fix

        Method levenshteinDistance has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function levenshteinDistance( $str1, $str2 ) {
                if ( $str1 === $str2 ) {
                    return 0;
                }
                $length1 = mb_strlen( $str1, 'UTF-8' );
        Severity: Minor
        Found in data/LanguageNameSearch.php - About 1 hr to fix

          Function append has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  append: function ( langCode, regionCode ) {
                      var i, regions;
          
                      if ( !$.uls.data.languages[ langCode ] ) {
                          // Language is unknown or not in the list of languages for this context.
          Severity: Minor
          Found in lib/jquery.uls/src/jquery.uls.lcd.js - About 1 hr to fix

            Function prepareInputmethods has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    prepareInputmethods: function ( language ) {
                        var index, inputSettings, $imeListContainer, defaultInputmethod,
                            imes, selected, imeId, $imeListTitle;
            
                        imes = $.ime.languages[ language ];
            Severity: Minor
            Found in resources/js/ext.uls.inputsettings.js - About 1 hr to fix

              Function createBoundaryTextRange has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          var createBoundaryTextRange = function(boundaryPosition, isStart) {
                              var boundaryNode, boundaryParent, boundaryOffset = boundaryPosition.offset;
                              var doc = dom.getDocument(boundaryPosition.node);
                              var workingNode, childNodes, workingRange = getBody(doc).createTextRange();
                              var nodeIsDataNode = isCharacterDataNode(boundaryPosition.node);
              Severity: Minor
              Found in lib/rangy/rangy-core.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                                if (comparison == -1 && boundaryNode && isCharacterDataNode(boundaryNode)) {
                                    // This is a character data node (text, comment, cdata). The working range is collapsed at the start of
                                    // the node containing the text range's boundary, so we move the end of the working range to the
                                    // boundary point and measure the length of its text to get the boundary's offset within the node.
                                    workingRange.setEndPoint(isStart ? "EndToStart" : "EndToEnd", textRange);
                Severity: Major
                Found in lib/rangy/rangy-core.js - About 1 hr to fix

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

                              if ( inputMethod !== 'system' ) {
                                  this.registry.previousInputMethods.unshift( inputMethod );
                                  this.registry.previousInputMethods =
                                      this.registry.previousInputMethods.slice( 0, 5 );
                              }
                  Severity: Major
                  Found in lib/jquery.ime/jquery.ime.js and 1 other location - About 1 hr to fix
                  lib/jquery.ime/jquery.ime.js on lines 1573..1576

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

                  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

                              if ( this.registry.previousLanguages.indexOf( language ) === -1 ) {
                                  this.registry.previousLanguages.unshift( language );
                                  this.registry.previousLanguages = this.registry.previousLanguages.slice( 0, 5 );
                              }
                  Severity: Major
                  Found in lib/jquery.ime/jquery.ime.js and 1 other location - About 1 hr to fix
                  lib/jquery.ime/jquery.ime.js on lines 1613..1617

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

                  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

                          patterns: [
                              [ '\\\\C', 'C' ],
                              [ '\\\\c', 'c' ],
                              [ '\\\\Q', 'Q' ],
                              [ '\\\\q', 'q' ],
                  Severity: Minor
                  Found in lib/jquery.ime/rules/gaa/gaa-cqx.js and 1 other location - About 55 mins to fix
                  lib/jquery.ime/rules/ff/ff-alt.js on lines 21..34

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

                  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

                          patterns_x: [
                              [ 'b', 'ɓ' ],
                              [ 'B', 'Ɓ' ],
                              [ 'd', 'ɗ' ],
                              [ 'D', 'Ɗ' ],
                  Severity: Minor
                  Found in lib/jquery.ime/rules/ff/ff-alt.js and 1 other location - About 55 mins to fix
                  lib/jquery.ime/rules/gaa/gaa-cqx.js on lines 15..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 54.

                  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 onBeforePageDisplay has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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

                  Function appendLanguages has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function appendLanguages( &$languages, $fontLanguages, $fontname ) {
                          foreach ( $fontLanguages as $rcode ) {
                              $code = str_replace( '*', '', $rcode );
                  
                              if ( !isset( $languages[$code] ) ) {
                  Severity: Minor
                  Found in includes/FontRepoCompiler.php - About 55 mins 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

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

                              this.$template.find( '#ui-font-selector-label strong' )
                                  .text( $.i18n( 'ext-uls-webfonts-select-for', $.uls.data.getAutonym( this.uiLanguage ) ) );
                  Severity: Minor
                  Found in resources/js/ext.uls.displaysettings.js and 1 other location - About 50 mins to fix
                  resources/js/ext.uls.displaysettings.js on lines 500..501

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

                  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.$template.find( '#content-font-selector-label strong' )
                                  .text( $.i18n( 'ext-uls-webfonts-select-for', $.uls.data.getAutonym( this.contentLanguage ) ) );
                  Severity: Minor
                  Found in resources/js/ext.uls.displaysettings.js and 1 other location - About 50 mins to fix
                  resources/js/ext.uls.displaysettings.js on lines 498..499

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

                  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

                                  for ( fontName in this.repository.fonts ) {
                                      if ( this.repository.fonts.hasOwnProperty( fontName ) ) {
                                          fontNames.push( fontName );
                                      }
                                  }
                  Severity: Minor
                  Found in lib/jquery.webfonts/src/jquery.webfonts.js and 1 other location - About 50 mins to fix
                  lib/jquery.webfonts/src/jquery.webfonts.js on lines 348..352

                  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

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

                              for ( language in this.repository.languages ) {
                                  if ( this.repository.languages.hasOwnProperty( language ) ) {
                                      languages.push( language );
                                  }
                              }
                  Severity: Minor
                  Found in lib/jquery.webfonts/src/jquery.webfonts.js and 1 other location - About 50 mins to fix
                  lib/jquery.webfonts/src/jquery.webfonts.js on lines 329..333

                  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

                  Avoid deeply nested control flow statements.
                  Open

                                          for (var i = 0, len = sel.rangeCount; i < len; ++i) {
                                              sel._ranges[i] = new api.WrappedRange(sel.nativeSelection.getRangeAt(i));
                                          }
                  Severity: Major
                  Found in lib/rangy/rangy-core.js - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language