wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

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

        if (meta.yAxisID === null || !(meta.yAxisID in scales) || dataset.yAxisID) {
            meta.yAxisID = dataset.yAxisID || scalesOpts.yAxes[0].id;
        }
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 3684..3686

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

    helpers$1.max = function(array) {
        return array.reduce(function(max, value) {
            if (!isNaN(value)) {
                return Math.max(max, 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 10358..10365

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

        if (meta.xAxisID === null || !(meta.xAxisID in scales) || dataset.xAxisID) {
            meta.xAxisID = dataset.xAxisID || scalesOpts.xAxes[0].id;
        }
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 3687..3689

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

Function showTranslationHelpers has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        showTranslationHelpers: function () {
            // API call to get translation suggestions from other languages
            // callback should render suggestions to the editor's info column
            var api = new mw.Api();

Severity: Minor
Found in resources/js/ext.translate.editor.helpers.js - About 1 hr to fix

    Function prepareMessageGroupRow has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            prepareMessageGroupRow: function ( messagegroup ) {
                var $row = $( '<div>' )
                    .addClass( 'row tux-grouplist__item' )
                    .attr( 'data-msggroupid', messagegroup.id )
                    .data( 'msggroup', messagegroup );
    Severity: Minor
    Found in resources/src/ext.translate.groupselector/index.js - About 1 hr to fix

      Function doFill has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function doFill(ctx, points, mapper, view, color, loop) {
          var count = points.length;
          var span = view.spanGaps;
          var curve0 = [];
          var curve1 = [];
      Severity: Minor
      Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

        Method onSpecialRecentChangesPanel has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function onSpecialRecentChangesPanel( &$extraOpts, $opts ) {
                global $wgLang, $wgRequest;
                if ( !$this->config->get( 'TranslateRecentChangesLanguageFilter' ) ) {
                    return;
                }
        Severity: Minor
        Found in src/TranslatorInterface/CleanChangesFilters.php - About 1 hr to fix

          Method showSearch has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function showSearch(
                  string $search,
                  string $count,
                  string $facets,
                  string $results,
          Severity: Minor
          Found in src/TtmServer/SearchTranslationsSpecialPage.php - About 1 hr to fix

            Method getMessageInfoHtml has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function getMessageInfoHtml( MessageUpdateParameter $message, Language $language ): string {
                    $output = Html::openElement( 'dl' );
            
                    $tags = [];
                    if ( $message->isFuzzy() ) {
            Severity: Minor
            Found in src/Synchronization/DisplayGroupSynchronizationInfo.php - About 1 hr to fix

              Method validateMessage has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function validateMessage(
                      IContextSource $context,
                      Content $content,
                      Status $status,
                      string $summary,
              Severity: Minor
              Found in src/HookHandler.php - About 1 hr to fix

                Method tagFuzzy has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function tagFuzzy( array $problematic ): void {
                        if ( $problematic === [] ) {
                            return;
                        }
                
                
                Severity: Minor
                Found in scripts/createCheckIndex.php - About 1 hr to fix

                  Method getMarkOperation has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getMarkOperation(
                          PageRecord $page,
                          ?int $revision,
                          bool $validateUnitTitle
                      ): TranslatablePageMarkOperation {
                  Severity: Minor
                  Found in src/PageTranslation/TranslatablePageMarker.php - About 1 hr to fix

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

                        public function execute(): void {
                            $params = $this->extractRequestParams();
                    
                            // The user we are operating on, not necessarily the user making the request
                            $user = $this->getUser();
                    Severity: Minor
                    Found in src/TranslatorSandbox/TranslationStashActionApi.php - About 1 hr to fix

                      Method searchMessages has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function searchMessages( string $query, int $maxResults ): array {
                              // Optimized based on requirements:
                              // * "Natural" sorting of results
                              // * No need to show which message group things belong to
                              // * Match at any point in the message
                      Severity: Minor
                      Found in src/TranslatorInterface/EntitySearch.php - About 1 hr to fix

                        Method searchProfileForm has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function searchProfileForm(
                                SpecialSearch $search,
                                string &$form,
                                string $profile,
                                string $term,
                        Severity: Minor
                        Found in src/HookHandler.php - About 1 hr to fix

                          Method run has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function run() {
                                  $title = $this->title;
                                  $fuzzyBot = FuzzyBot::getUser();
                                  $summary = $this->getSummary();
                                  $base = $this->getBase();
                          Severity: Minor
                          Found in src/MessageGroupProcessing/DeleteTranslatableBundleJob.php - About 1 hr to fix

                            Method identifyDifferences has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function identifyDifferences(
                                    array $translatableBundles,
                                    array $translatableBundleStatuses
                                ): array {
                                    $result = [
                            Severity: Minor
                            Found in src/Diagnostics/SyncTranslatableBundleStatusMaintenanceScript.php - About 1 hr to fix

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

                                  getPixelForTick: function(index) {
                                      var ticks = this.tickValues;
                                      if (index < 0 || index > ticks.length - 1) {
                                          return null;
                                      }
                              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 13052..13058

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

                              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 ( computed.overflowY === 'hidden' ) {
                                                  changeOverflow( 'scroll' );
                                                  resize();
                                                  actualHeight = computed.boxSizing === 'content-box' ? Math.round( parseFloat( window.getComputedStyle( ta, null ).height ) ) : ta.offsetHeight;
                                              }
                              Severity: Major
                              Found in resources/lib/jquery.autosize.js and 1 other location - About 1 hr to fix
                              resources/lib/jquery.autosize.js on lines 168..172

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

                              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