wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Function draw has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    draw: function() {
        var me = this;
        var ctx = me.ctx;
        var opts = me.options;

Severity: Minor
Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

    Method startSync has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function startSync( array $modificationJobs, array $renameJobs ): void {
            // We are adding an empty array for groups that have no jobs. This is mainly done to
            // avoid adding unnecessary checks. Remove those using array_filter
            $modificationGroupIds = array_keys( array_filter( $modificationJobs ) );
            $renameGroupIds = array_keys( array_filter( $renameJobs ) );
    Severity: Minor
    Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

      Method showRenames has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function showRenames(
              MessageGroup $group,
              MessageSourceChange $sourceChanges,
              OutputPage $out,
              string $language,
      Severity: Minor
      Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

        Method getMessageParameters has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function getMessageParameters(): array {
                $params = parent::getMessageParameters();
                $legacy = $this->entry->getParameters();
        
                $type = $this->entry->getFullType();
        Severity: Minor
        Found in src/MessageGroupProcessing/TranslatableBundleLogFormatter.php - About 1 hr to fix

          Method writeReal has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function writeReal( MessageCollection $collection ): string {
                  global $wgTranslateDocumentationLanguageCode;
          
                  $collection->filter( 'hastranslation', false );
                  if ( count( $collection ) === 0 ) {
          Severity: Minor
          Found in src/FileFormatSupport/AndroidXmlFormat.php - About 1 hr to fix

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

                        if ( this.options.targetlangcode === mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
                            targetLangAttrib = mw.config.get( 'wgContentLanguage' );
                        } else {
                            targetLangAttrib = this.options.targetlangcode;
                        }
            Severity: Major
            Found in resources/js/ext.translate.proofread.js and 1 other location - About 1 hr to fix
            resources/js/ext.translate.pagemode.js on lines 77..81

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

            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

                        if ( this.options.targetlangcode === mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
                            targetLangAttrib = mw.config.get( 'wgContentLanguage' );
                        } else {
                            targetLangAttrib = this.options.targetlangcode;
                        }
            Severity: Major
            Found in resources/js/ext.translate.pagemode.js and 1 other location - About 1 hr to fix
            resources/js/ext.translate.proofread.js on lines 125..129

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

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

            function getBackgroundPoint(vm, size, alignment, chart) {
                // Background Position
                var x = vm.x;
                var y = vm.y;
            
            
            Severity: Minor
            Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

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

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

                Function search has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        search: function ( query ) {
                            var resultCount = 0,
                                matcher = new RegExp( '(^|\\s|\\b)' + escapeRegex( query ), 'i' );
                
                            this.$container.find( itemsClass[ this.mode ] ).each( function () {
                Severity: Minor
                Found in resources/js/ext.translate.messagetable.js - About 1 hr to fix

                  Method fetchTranslatableTemplateAndTitle has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function fetchTranslatableTemplateAndTitle(
                          ?LinkTarget $contextLink,
                          ?LinkTarget $templateLink,
                          bool &$skip,
                          ?RevisionRecord &$revRecord
                  Severity: Minor
                  Found in src/PageTranslation/Hooks.php - About 1 hr to fix

                    Method sourcePageHeader has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static function sourcePageHeader( IContextSource $context ) {
                            $linker = MediaWikiServices::getInstance()->getLinkRenderer();
                    
                            $language = $context->getLanguage();
                            $title = $context->getTitle();
                    Severity: Minor
                    Found in src/PageTranslation/Hooks.php - About 1 hr to fix

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

                          protected function processGroups( array $groups ): array {
                              $fixedGroups = [];
                              foreach ( $groups as $g ) {
                                  $name = $g['name'];
                                  $sanitizedName = preg_replace( '/\s+/', '', strtolower( $name ) );
                      Severity: Minor
                      Found in src/MessageGroupConfiguration/PremadeIntuitionTextdomains.php - About 1 hr to fix

                        Method beginBootstrap has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function beginBootstrap(): void {
                                $this->checkElasticsearchVersion();
                                $index = $this->getIndex();
                                if ( $this->updateMapping ) {
                                    $this->logOutput( 'Updating the index mappings...' );
                        Severity: Minor
                        Found in src/TtmServer/ElasticSearchTtmServer.php - About 1 hr to fix

                          Method extractMessages has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function extractMessages( array $documents ): array {
                                  $messages = $ret = [];
                          
                                  $language = $this->params['language'];
                                  foreach ( $documents as $document ) {
                          Severity: Minor
                          Found in src/TtmServer/CrossLanguageTranslationSearchQuery.php - About 1 hr to fix

                            Method identifySafeLanguages has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function identifySafeLanguages(
                                    FileBasedMessageGroup $group,
                                    MessageSourceChange $changesForGroup,
                                    int $importStrategy
                                ): array {
                            Severity: Minor
                            Found in src/Synchronization/ExternalMessageSourceStateImporter.php - About 1 hr to fix

                              Method getParentGroups has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function getParentGroups( MessageGroup $targetGroup ): array {
                                      $ids = self::getSharedGroups( $targetGroup );
                                      if ( $ids === [] ) {
                                          return [];
                                      }
                              Severity: Minor
                              Found in src/MessageGroupProcessing/MessageGroups.php - About 1 hr to fix

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

                                    helpers$1.min = function(array) {
                                        return array.reduce(function(min, value) {
                                            if (!isNaN(value)) {
                                                return Math.min(min, value);
                                            }
                                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 10350..10357

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

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

                                        if (a < 1) {
                                            a = 1;
                                            s = p / 4;
                                        } else {
                                            s = p / (2 * Math.PI) * Math.asin(1 / a);
                                Severity: Major
                                Found in resources/lib/Chart.js/Chart.js and 2 other locations - About 1 hr to fix
                                resources/lib/Chart.js/Chart.js on lines 2621..2626
                                resources/lib/Chart.js/Chart.js on lines 2643..2648

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

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

                                        if (a < 1) {
                                            a = 1;
                                            s = p / 4;
                                        } else {
                                            s = p / (2 * Math.PI) * Math.asin(1 / a);
                                Severity: Major
                                Found in resources/lib/Chart.js/Chart.js and 2 other locations - About 1 hr to fix
                                resources/lib/Chart.js/Chart.js on lines 2599..2604
                                resources/lib/Chart.js/Chart.js on lines 2621..2626

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

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language