wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

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

EntitySelectorWidget.prototype.getLookupRequest = function () {
    var value = this.getValue();
    var widget = this;

    if ( !this.allowSuggestionsWhenEmpty && value === '' ) {
Severity: Minor
Found in resources/src/ext.translate.entity.selector/index.js - About 1 hr 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 rgb has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      convert.hsl.rgb = function (hsl) {
          var h = hsl[0] / 360;
          var s = hsl[1] / 100;
          var l = hsl[2] / 100;
          var t1;
      Severity: Minor
      Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

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

        var Color = function (obj) {
            if (obj instanceof Color) {
                return obj;
            }
            if (!(this instanceof Color)) {
        Severity: Minor
        Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

          Method doCreate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function doCreate(): void {
                  $params = $this->extractRequestParams();
          
                  // Do validations
                  foreach ( explode( '|', 'username|password|email' ) as $field ) {
          Severity: Minor
          Found in src/TranslatorSandbox/TranslatorSandboxActionApi.php - About 1 hr to fix

            Method processGroups has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function processGroups( array $groups ): array {
                    $fixedGroups = [];
                    foreach ( $groups as $g ) {
                        $name = $g['name'];
            
            
            Severity: Minor
            Found in src/MessageGroupConfiguration/PremadeMediaWikiExtensionGroups.php - About 1 hr to fix

              Method tuxLanguageSelector has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function tuxLanguageSelector(): string {
                      if ( $this->options['language'] === $this->getConfig()->get( 'TranslateDocumentationLanguageCode' ) ) {
                          $targetLangName = $this->msg( 'translate-documentation-language' )->text();
                          $targetLanguage = $this->contentLanguage;
                      } else {
              Severity: Minor
              Found in src/TranslatorInterface/TranslateSpecialPage.php - About 1 hr to fix

                Method makeGroupFacetRows has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function makeGroupFacetRows(
                        array $groups,
                        array $counts,
                        int $level = 0,
                        string $pathString = ''
                Severity: Minor
                Found in src/TtmServer/SearchTranslationsSpecialPage.php - About 1 hr to fix

                  Method execute has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function execute() {
                          $name = $this->getOption( 'name', MessageChangeStorage::DEFAULT_NAME );
                          if ( !MessageChangeStorage::isValidCdbName( $name ) ) {
                              $this->fatalError( 'Invalid name' );
                          }
                  Severity: Minor
                  Found in src/Synchronization/ImportExternalTranslationsMaintenanceScript.php - About 1 hr to fix

                    Method unflatten has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function unflatten( array $flat ): array {
                            $unflat = [];
                    
                            if ( $this->parseCLDRPlurals ) {
                                $unflattenedPlurals = [];
                    Severity: Minor
                    Found in src/MessageProcessing/ArrayFlattener.php - About 1 hr to fix

                      Method getIssues has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getIssues( Message $message, string $targetLanguage ): ValidationIssues {
                              $issues = new ValidationIssues();
                      
                              // We skip certain validations if we don't know the expected keywords
                              $expectedKeywords = UnicodePlural::getPluralKeywords( $targetLanguage );
                      Severity: Minor
                      Found in src/Validation/Validators/UnicodePluralValidator.php - About 1 hr to fix

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

                                    $( '<div>' )
                                        .text( '↑' )
                                        .addClass( 'shortcut-popup' )
                                        .appendTo( document.body )
                                        .offset( { top: middle - 15, left: maxLeft } )
                        Severity: Major
                        Found in resources/js/ext.translate.editor.shortcuts.js and 1 other location - About 1 hr to fix
                        resources/js/ext.translate.editor.shortcuts.js on lines 30..35

                        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

                                    $( '<div>' )
                                        .text( '↓' )
                                        .addClass( 'shortcut-popup' )
                                        .appendTo( document.body )
                                        .offset( { top: middle + 15, left: maxLeft } )
                        Severity: Major
                        Found in resources/js/ext.translate.editor.shortcuts.js and 1 other location - About 1 hr to fix
                        resources/js/ext.translate.editor.shortcuts.js on lines 23..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 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

                                    text = text.replace( /\[\[(.+?)\]\]/g, function ( match, p1 ) {
                                        var $link = $( '<a>' ).html( p1 ).prop( 'href', mw.util.getUrl( p1 ) );
                                        return $( '<div>' ).append( $link ).html();
                                    } );
                        Severity: Major
                        Found in resources/js/ext.translate.parsers.js and 1 other location - About 1 hr to fix
                        resources/js/ext.translate.parsers.js on lines 52..55

                        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

                                    text = text.replace( /\[\[([^\]|]+?)\|(.+?)\]\]/g, function ( match, p1, p2 ) {
                                        var $link = $( '<a>' ).html( p2 ).prop( 'href', mw.util.getUrl( p1 ) );
                                        return $( '<div>' ).append( $link ).html();
                                    } );
                        Severity: Major
                        Found in resources/js/ext.translate.parsers.js and 1 other location - About 1 hr to fix
                        resources/js/ext.translate.parsers.js on lines 57..60

                        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

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

                        Color.prototype.setValues = function (space, vals) {
                            var values = this.values;
                            var spaces = this.spaces;
                            var maxes = this.maxes;
                            var alpha = 1;
                        Severity: Minor
                        Found in resources/lib/Chart.js/Chart.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 hsv has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            convert.rgb.hsv = function (rgb) {
                                var rdif;
                                var gdif;
                                var bdif;
                                var h;
                            Severity: Minor
                            Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

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

                                  function associate( event, subGroupId ) {
                                      var $target = $( event.target ),
                                          $parent = $target.parents( '.mw-tpa-group' ),
                                          parentId = $parent.data( 'id' ),
                                          subgroupName = $parent
                              Severity: Minor
                              Found in resources/js/ext.translate.special.aggregategroups.js - About 1 hr to fix

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

                                function fitWithPointLabels(scale) {
                                
                                    // Right, this is really confusing and there is a lot of maths going on here
                                    // The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9
                                    //
                                Severity: Minor
                                Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language