wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Method getRenameJobParams has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getRenameJobParams(
        array $currentMsg,
        MessageSourceChange $sourceChanges,
        string $languageCode,
        int $groupNamespace,
Severity: Minor
Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

    Method makeNumberColumns has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function makeNumberColumns( array $stats ): string {
            $total = $stats[MessageGroupStats::TOTAL];
            $translated = $stats[MessageGroupStats::TRANSLATED];
            $fuzzy = $stats[MessageGroupStats::FUZZY];
            $proofread = $stats[MessageGroupStats::PROOFREAD];
    Severity: Minor
    Found in src/Statistics/StatsTable.php - About 1 hr to fix

      Method onPageSaveComplete has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function onPageSaveComplete(
              $wikiPage,
              $user,
              $summary,
              $flags,
      Severity: Minor
      Found in src/MessageBundleTranslation/Hooks.php - About 1 hr to fix

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

            public function execute() {
                $this->language = $this->getServiceContainer()->getContentLanguage();
        
                $groupInput = $this->getOption( 'group', '*' );
                $groupIdPattern = self::commaList2Array( $groupInput );

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

              _dataElementOptions: {
                  backgroundColor: 'pointBackgroundColor',
                  borderColor: 'pointBorderColor',
                  borderWidth: 'pointBorderWidth',
                  hitRadius: 'pointHitRadius',
          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 6460..6472

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

          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

              function getGroups() {
                  var groups = $form.find( 'input[name="group"]' ).val().trim();
          
                  if ( groups.length > 0 ) {
                      return getSplitValues( groups );
          Severity: Major
          Found in resources/js/ext.translate.special.translationstats.js and 1 other location - About 1 hr to fix
          resources/js/ext.translate.special.translationstats.js on lines 24..32

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

          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

              _dataElementOptions: {
                  backgroundColor: 'pointBackgroundColor',
                  borderColor: 'pointBorderColor',
                  borderWidth: 'pointBorderWidth',
                  hitRadius: 'pointHitRadius',
          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 5856..5868

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

          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

          Method getDefinitions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getDefinitions() {
                  $groups = MessageGroups::getAllGroups();
                  $keys = [];
          
                  /** @var $g MessageGroup */
          Severity: Minor
          Found in messagegroups/WorkflowStatesMessageGroup.php - About 1 hr to fix

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

                function getLanguages() {
                    var languages = $form.find( 'input[name="language"]' ).val().trim();
            
                    if ( languages.length > 0 ) {
                        return getSplitValues( languages );
            Severity: Major
            Found in resources/js/ext.translate.special.translationstats.js and 1 other location - About 1 hr to fix
            resources/js/ext.translate.special.translationstats.js on lines 34..42

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

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

            function interpolate(start, view, model, ease) {
                var keys = Object.keys(model);
                var i, ilen, key, actual, origin, target, type, c0, c1;
            
                for (i = 0, ilen = keys.length; i < ilen; ++i) {
            Severity: Minor
            Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

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

                  top: function ( position, data ) {
                      var within = data.within,
                          withinOffset = within.offset.top + within.scrollTop,
                          outerHeight = within.height,
                          offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
              Severity: Minor
              Found in resources/src/ext.translate.groupselector/ui.position.js - About 1 hr to fix

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

                    updateElement: function(arc, index, reset) {
                        var me = this;
                        var chart = me.chart;
                        var dataset = me.getDataset();
                        var opts = chart.options;
                Severity: Minor
                Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

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

                      determineDataLimits: function() {
                          var me = this;
                          var opts = me.options;
                          var chart = me.chart;
                          var datasets = chart.data.datasets;
                  Severity: Minor
                  Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

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

                        private function validateUnitNames(
                            TranslatablePage $page,
                            array $units,
                            bool $includePageDisplayTitle
                        ): Status {
                    Severity: Minor
                    Found in src/PageTranslation/TranslatablePageMarker.php - About 1 hr to fix

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

                          private function prepareTranslationUnits( TranslatablePage $page, ParserOutput $parserOutput ): array {
                              $highest = (int)$this->messageGroupMetadata->get( $page->getMessageGroupId(), 'maxid' );
                      
                              $store = $this->translationUnitStoreFactory->getReader( $page->getPageIdentity() );
                              $storedUnits = $store->getUnits();
                      Severity: Minor
                      Found in src/PageTranslation/TranslatablePageMarker.php - About 1 hr to fix

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

                            private function showPage(): void {
                                $out = $this->getOutput();
                                $user = $this->getUser();
                        
                                $count = count( $this->stash->getTranslations( $user ) );
                        Severity: Minor
                        Found in src/TranslatorSandbox/TranslationStashSpecialPage.php - About 1 hr to fix

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

                              public function getData(): array {
                                  $pageTitle = $this->handle->getTitle();
                                  if ( !$pageTitle->exists() ) {
                                      return [];
                                  }
                          Severity: Minor
                          Found in src/TranslatorInterface/Aid/EditSummariesAid.php - About 1 hr to fix

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

                                private function tuxLanguageSelector(): string {
                                    // The name will be displayed in the UI language,
                                    // so use for lang and dir
                                    $language = $this->getTargetLanguage();
                                    $targetLangName = $this->languageNameUtils->getLanguageName( $language->getCode() );
                            Severity: Minor
                            Found in src/TranslatorSandbox/TranslationStashSpecialPage.php - About 1 hr to fix

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

                                  public function addGroupErrors( GroupSynchronizationResponse $response ): void {
                                      $groupId = $response->getGroupId();
                                      $remainingMessages = $response->getRemainingMessages();
                              
                                      if ( !$remainingMessages ) {
                              Severity: Minor
                              Found in src/Synchronization/GroupSynchronizationCache.php - About 1 hr to fix

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

                                    private function outputForm(): void {
                                        $fields = [
                                            'group' => [
                                                'type' => 'select',
                                                'name' => 'group',
                                Severity: Minor
                                Found in src/Synchronization/ExportTranslationsSpecialPage.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language