wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

File ext.translate.special.managetranslatorsandbox.js has 558 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * JS for special page.
 * @author Niklas Laxström
 * @author Sucheta Ghoshal
 * @author Amir E. Aharoni
Severity: Major
Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 1 day to fix

    File MessageCollection.php has 546 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    declare( strict_types = 1 );
    
    namespace MediaWiki\Extension\Translate\MessageLoading;
    
    
    Severity: Major
    Found in src/MessageLoading/MessageCollection.php - About 1 day to fix

      File ext.translate.editor.helpers.js has 528 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * Translate editor additional helper functionality
       */
      ( function () {
          'use strict';
      Severity: Major
      Found in resources/js/ext.translate.editor.helpers.js - About 1 day to fix

        Function execute has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
        Open

            public function execute() {
                $logger = LoggerFactory::getInstance( 'Translate.GroupSynchronization' );
                $groupPattern = $this->getOption( 'group' ) ?? '';
                $groupSkipPattern = $this->getOption( 'skipgroup' ) ?? '';
                $skipGroupSyncCheck = $this->hasOption( 'skip-group-sync-check' );
        Severity: Minor
        Found in src/Synchronization/ExportTranslationsMaintenanceScript.php - About 1 day 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

        File ElasticSearchTtmServer.php has 519 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        declare( strict_types = 1 );
        
        namespace MediaWiki\Extension\Translate\TtmServer;
        
        
        Severity: Major
        Found in src/TtmServer/ElasticSearchTtmServer.php - About 1 day to fix

          File SearchTranslationsSpecialPage.php has 518 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          declare( strict_types = 1 );
          
          namespace MediaWiki\Extension\Translate\TtmServer;
          
          
          Severity: Major
          Found in src/TtmServer/SearchTranslationsSpecialPage.php - About 1 day to fix

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

                setDimensions: function() {
                    var me = this;
                    // Set the unconstrained dimension before label rotation
                    if (me.isHorizontal()) {
                        // Reset position before calculating rotation
            Severity: Major
            Found in resources/lib/Chart.js/Chart.js and 1 other location - About 1 day to fix
            resources/lib/Chart.js/Chart.js on lines 15817..15844

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

            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

                setDimensions: function() {
                    var me = this;
                    // Set the unconstrained dimension before label rotation
                    if (me.isHorizontal()) {
                        // Reset position before calculating rotation
            Severity: Major
            Found in resources/lib/Chart.js/Chart.js and 1 other location - About 1 day to fix
            resources/lib/Chart.js/Chart.js on lines 15288..15315

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

            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

            File GettextFormat.php has 512 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            declare( strict_types = 1 );
            
            namespace MediaWiki\Extension\Translate\FileFormatSupport;
            
            
            Severity: Major
            Found in src/FileFormatSupport/GettextFormat.php - About 1 day to fix

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

                      labels: {
                          generateLabels: function(chart) {
                              var data = chart.data;
                              if (data.labels.length && data.datasets.length) {
                                  return data.labels.map(function(label, i) {
              Severity: Major
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 1 day to fix
              resources/lib/Chart.js/Chart.js on lines 5358..5380

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

              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

                      labels: {
                          generateLabels: function(chart) {
                              var data = chart.data;
                              if (data.labels.length && data.datasets.length) {
                                  return data.labels.map(function(label, i) {
              Severity: Major
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 1 day to fix
              resources/lib/Chart.js/Chart.js on lines 6176..6198

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

              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

              File groupStatistics.php has 502 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Commandline script to general statistics about the localisation level of
               * one or more message groups.
               *
              Severity: Major
              Found in scripts/groupStatistics.php - About 1 day to fix

                File ext.translate.special.translate.js has 500 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                ( function () {
                    'use strict';
                
                    var state, hideOptionalMessages = '!optional';
                
                
                Severity: Minor
                Found in resources/js/ext.translate.special.translate.js - About 1 day to fix

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

                      public function execute( $subPage ) {
                          $this->setHeaders();
                          $this->checkPermissions();
                  
                          $server = $this->ttmServerFactory->getDefaultForQuerying();
                  Severity: Major
                  Found in src/TtmServer/SearchTranslationsSpecialPage.php - About 7 hrs to fix

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

                        update: function(maxWidth, maxHeight, margins) {
                            var me = this;
                    
                            // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
                            me.beforeUpdate();
                    Severity: Major
                    Found in resources/lib/Chart.js/Chart.js and 1 other location - About 7 hrs to fix
                    resources/lib/Chart.js/Chart.js on lines 15254..15282

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

                    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

                        update: function(maxWidth, maxHeight, margins) {
                            var me = this;
                    
                            // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
                            me.beforeUpdate();
                    Severity: Major
                    Found in resources/lib/Chart.js/Chart.js and 1 other location - About 7 hrs to fix
                    resources/lib/Chart.js/Chart.js on lines 15782..15811

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

                    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

                        setHoverStyle: function(point) {
                            var model = point._model;
                            var options = point._options;
                            var getHoverColor = helpers$1.getHoverColor;
                    
                    
                    Severity: Major
                    Found in resources/lib/Chart.js/Chart.js and 1 other location - About 7 hrs to fix
                    resources/lib/Chart.js/Chart.js on lines 6613..6629

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

                    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

                        setHoverStyle: function(point) {
                            var model = point._model;
                            var options = point._options;
                            var getHoverColor = helpers$1.getHoverColor;
                    
                    
                    Severity: Major
                    Found in resources/lib/Chart.js/Chart.js and 1 other location - About 7 hrs to fix
                    resources/lib/Chart.js/Chart.js on lines 6109..6125

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

                    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 ( overTop < 0 ) {
                                newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
                                    outerHeight - withinOffset;
                                if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
                                    position.top += myOffset + atOffset + offset;
                    Severity: Major
                    Found in resources/src/ext.translate.groupselector/ui.position.js and 1 other location - About 7 hrs to fix
                    resources/src/ext.translate.groupselector/ui.position.js on lines 148..160

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

                    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 ( overLeft < 0 ) {
                                newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
                                    outerWidth - withinOffset;
                                if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
                                    position.left += myOffset + atOffset + offset;
                    Severity: Major
                    Found in resources/src/ext.translate.groupselector/ui.position.js and 1 other location - About 7 hrs to fix
                    resources/src/ext.translate.groupselector/ui.position.js on lines 184..196

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

                    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