wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

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

    public function execute() {
        $ignoreTrailingWhitespace = $this->getOption( 'ignore-trailing-whitespace' );
        $groups = $this->getGroups( $this->getArg( 0 ) );
        $matched = count( $groups );
        $this->output( "Pattern matched $matched file based message group(s).\n" );
Severity: Minor
Found in src/Diagnostics/FindUnsynchronizedDefinitionsMaintenanceScript.php - About 1 hr to fix

    Method handleSourceRename has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function handleSourceRename(
            MessageSourceChange $sourceChanges,
            string $code,
            string $msgKey,
            string $keyToRename
    Severity: Minor
    Found in src/MessageGroupProcessing/ManageMessageGroupsActionApi.php - About 1 hr to fix

      Method getAllowedParams has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getAllowedParams(): array {
              $allowedParams = [
                  'depth' => [
                      ParamValidator::PARAM_TYPE => 'integer',
                      ParamValidator::PARAM_DEFAULT => 100,
      Severity: Minor
      Found in src/MessageGroupProcessing/QueryMessageGroupsActionApi.php - About 1 hr to fix

        Method breakRename has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function breakRename( $languageCode, $msgKey ) {
                $msg = $this->findMessage( $languageCode, $msgKey, [ self::RENAME ] );
                if ( $msg === null ) {
                    return null;
                }
        Severity: Minor
        Found in src/MessageSync/MessageSourceChange.php - About 1 hr to fix

          Method readFromVariable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function readFromVariable( string $data ): array {
                  $lines = explode( "\n", $data );
                  $authors = $messages = [];
                  $linecontinuation = false;
          
          
          Severity: Minor
          Found in src/FileFormatSupport/AppleFormat.php - About 1 hr to fix

            Method getExtraSchema has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function getExtraSchema(): array {
                    $schema = [
                        'root' => [
                            '_type' => 'array',
                            '_children' => [
            Severity: Minor
            Found in messagegroups/FileBasedMessageGroup.php - About 1 hr to fix

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

                          var $infoColumnBlock = this.$editor.find( '.infocolumn-block' ),
                              $editColumn = this.$editor.find( '.editcolumn' ),
                              $messageDescEditor = $infoColumnBlock.find( '.message-desc-editor' ),
                              $messageDescViewer = $infoColumnBlock.find( '.message-desc-viewer' );
              Severity: Major
              Found in resources/js/ext.translate.editor.helpers.js and 1 other location - About 1 hr to fix
              resources/js/ext.translate.editor.helpers.js on lines 55..58

              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 2 locations. Consider refactoring.
              Open

                          $groupWarning.append(
                              $( '<p>' ).append( $( '<strong>' ).text( headerMessage.text() ) ),
                              $( '<p>' ).text( languagesMessage.text() )
                          );
              Severity: Major
              Found in resources/js/ext.translate.special.translate.js and 1 other location - About 1 hr to fix
              resources/js/ext.translate.special.translate.js on lines 312..315

              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 2 locations. Consider refactoring.
              Open

                      $groupWarning.append(
                          $( '<p>' ).append( $( '<strong>' ).text( headerMessage.text() ) ),
                          $( '<p>' ).append( languagesMessage.parseDom() )
                      );
              Severity: Major
              Found in resources/js/ext.translate.special.translate.js and 1 other location - About 1 hr to fix
              resources/js/ext.translate.special.translate.js on lines 267..270

              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 2 locations. Consider refactoring.
              Open

                                  if (i < points.length - 1 && isPointInArea(points[i + 1]._model, area)) {
                                      model.controlPointNextX = capControlPoint(model.controlPointNextX, area.left, area.right);
                                      model.controlPointNextY = capControlPoint(model.controlPointNextY, area.top, area.bottom);
                                  }
              Severity: Major
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 1 hr to fix
              resources/lib/Chart.js/Chart.js on lines 6061..6064

              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

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

                          var $infoColumnBlock = this.$editor.find( '.infocolumn-block' ),
                              $editColumn = this.$editor.find( '.editcolumn' ),
                              $messageDescEditor = $infoColumnBlock.find( '.message-desc-editor' ),
                              $messageDescViewer = $infoColumnBlock.find( '.message-desc-viewer' );
              Severity: Major
              Found in resources/js/ext.translate.editor.helpers.js and 1 other location - About 1 hr to fix
              resources/js/ext.translate.editor.helpers.js on lines 32..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 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 2 locations. Consider refactoring.
              Open

                                  if (i > 0 && isPointInArea(points[i - 1]._model, area)) {
                                      model.controlPointPreviousX = capControlPoint(model.controlPointPreviousX, area.left, area.right);
                                      model.controlPointPreviousY = capControlPoint(model.controlPointPreviousY, area.top, area.bottom);
                                  }
              Severity: Major
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 1 hr to fix
              resources/lib/Chart.js/Chart.js on lines 6065..6068

              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

              Consider simplifying this complex logical expression.
              Open

                      if (circumference < DOUBLE_PI$1) {
                          var startAngle = opts.rotation % DOUBLE_PI$1;
                          startAngle += startAngle >= PI$1 ? -DOUBLE_PI$1 : startAngle < -PI$1 ? DOUBLE_PI$1 : 0;
                          var endAngle = startAngle + circumference;
                          var startX = Math.cos(startAngle);
              Severity: Critical
              Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

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

                        if ( $unknownLanguages !== [] ) {
                            $msg = ( new RawMessage( "Removing rows for $1 unknown language{{PLURAL:$1||s}}:\n" ) )
                                ->numParams( count( $unknownLanguages ) )
                                ->inLanguage( 'en' )
                                ->text();
                src/Statistics/CleanupTranslationProgressStatsMaintenanceScript.php on lines 41..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 107.

                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 ( $unknownGroupIds !== [] ) {
                            $msg = ( new RawMessage( "Removing rows for $1 unknown group{{PLURAL:$1||s}}:\n" ) )
                                ->numParams( count( $unknownGroupIds ) )
                                ->inLanguage( 'en' )
                                ->text();
                src/Statistics/CleanupTranslationProgressStatsMaintenanceScript.php on lines 66..80

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

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

                    function editGroup( event ) {
                        var $target = $( event.target ),
                            $parent = $target.closest( '.mw-tpa-group' ),
                            aggregateGroupId = $parent.data( 'groupid' ),
                            $displayGroup = $parent.children( '.tp-display-group' ),
                Severity: Minor
                Found in resources/js/ext.translate.special.aggregategroups.js - About 1 hr to fix

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

                      construct: function(item, config) {
                          var me = this;
                  
                          config = initConfig(config);
                  
                  
                  Severity: Minor
                  Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

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

                        left: function ( position, data ) {
                            var within = data.within,
                                withinOffset = within.offset.left + within.scrollLeft,
                                outerWidth = within.width,
                                offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
                    Severity: Minor
                    Found in resources/src/ext.translate.groupselector/ui.position.js - About 1 hr to fix

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

                              showMachineTranslations: function ( suggestions ) {
                                  if ( !suggestions.length ) {
                                      return;
                                  }
                      
                      
                      Severity: Minor
                      Found in resources/js/ext.translate.editor.helpers.js - About 1 hr to fix

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

                                render: function () {
                                    var sourceLangDir = $.uls.data.getDir( this.options.sourcelangcode );
                        
                                    var targetLangAttrib;
                                    if ( this.options.targetlangcode === mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
                        Severity: Minor
                        Found in resources/js/ext.translate.pagemode.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language