wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method makeFreeExternalLink has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function makeFreeExternalLink( $url, $numPostProto ) {
        $trail = '';

        # The characters '<' and '>' (which were escaped by
        # internalRemoveHtmlTags()) should not be included in
Severity: Major
Found in includes/parser/Parser.php - About 2 hrs to fix

    Method splitTagStack has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function splitTagStack( SerializerNode $parentNode, $inline, $pos ) {
            $parentData = $parentNode->snData;
            $wrapBase = $parentData->wrapBaseNode;
            $pWrap = $parentData->ancestorPNode;
            if ( !$pWrap ) {
    Severity: Major
    Found in includes/tidy/RemexCompatMunger.php - About 2 hrs to fix

      Method updateOptions has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function updateOptions() {
              $dryRun = $this->hasOption( 'dry' );
              $settingWord = $dryRun ? 'Would set' : 'Setting';
              $option = $this->getArg( 0 );
              $fromIsDefault = $this->hasOption( 'old-is-default' );
      Severity: Major
      Found in maintenance/userOptions.php - About 2 hrs to fix

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

            public function execute() {
                $this->initServices();
        
                $fromPattern = new Pattern( 'from', $this->getOption( 'from' ) );
                $toPattern = new Pattern( 'to', $this->getOption( 'to' ) );
        Severity: Major
        Found in maintenance/renameUsersMatchingPattern.php - About 2 hrs to fix

          Method doDelete has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function doDelete( $delete = false, $pageIds = [] ) {
                  # Data should come off the master, wrapped in a transaction
                  $dbw = $this->getPrimaryDB();
                  $this->beginTransaction( $dbw, __METHOD__ );
          
          
          Severity: Major
          Found in maintenance/deleteOldRevisions.php - About 2 hrs to fix

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

                public function execute() {
                    $name = $this->getArg( 0 );
                    $delete = $this->hasOption( 'delete' );
            
                    $dbw = $this->getPrimaryDB();
            Severity: Major
            Found in maintenance/nukePage.php - About 2 hrs to fix

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

              OO.ui.DropdownInputWidget.prototype.setDisabled = function ( state ) {
                  this.dropdownWidget.setDisabled( state );
                  OO.ui.DropdownInputWidget.super.prototype.setDisabled.call( this, state );
                  return this;
              };
              Severity: Major
              Found in resources/lib/ooui/oojs-ui-core.js and 2 other locations - About 2 hrs to fix
              resources/lib/ooui/oojs-ui-core.js on lines 11111..11115
              resources/lib/ooui/oojs-ui-core.js on lines 11337..11341

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

              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

              OO.ui.RadioSelectInputWidget.prototype.setDisabled = function ( state ) {
                  this.radioSelectWidget.setDisabled( state );
                  OO.ui.RadioSelectInputWidget.super.prototype.setDisabled.call( this, state );
                  return this;
              };
              Severity: Major
              Found in resources/lib/ooui/oojs-ui-core.js and 2 other locations - About 2 hrs to fix
              resources/lib/ooui/oojs-ui-core.js on lines 10671..10675
              resources/lib/ooui/oojs-ui-core.js on lines 11337..11341

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

              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 (!event.metaKey && !event.ctrlKey) {
                              selectee.$element.removeClass('ui-selected');
                              selectee.selected = false;
                              selectee.$element.addClass('ui-unselecting');
                              selectee.unselecting = true;
              Severity: Major
              Found in resources/lib/jquery.ui/jquery.ui.selectable.js and 1 other location - About 2 hrs to fix
              resources/lib/jquery.ui/jquery.ui.selectable.js on lines 208..218

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

              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 (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
                                      selectee.$element.removeClass('ui-selected');
                                      selectee.selected = false;
              
                                      selectee.$element.addClass('ui-unselecting');
              Severity: Major
              Found in resources/lib/jquery.ui/jquery.ui.selectable.js and 1 other location - About 2 hrs to fix
              resources/lib/jquery.ui/jquery.ui.selectable.js on lines 104..113

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

              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

              OO.ui.CheckboxMultiselectInputWidget.prototype.setDisabled = function ( state ) {
                  this.checkboxMultiselectWidget.setDisabled( state );
                  OO.ui.CheckboxMultiselectInputWidget.super.prototype.setDisabled.call( this, state );
                  return this;
              };
              Severity: Major
              Found in resources/lib/ooui/oojs-ui-core.js and 2 other locations - About 2 hrs to fix
              resources/lib/ooui/oojs-ui-core.js on lines 10671..10675
              resources/lib/ooui/oojs-ui-core.js on lines 11111..11115

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

              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

                  return function () {
                      // Check how long it's been since the last time the function was
                      // called, and whether it's more or less than the requested throttle
                      // period. If it's less, run the function immediately. If it's more,
                      // set a timeout for the remaining time -- but don't replace an
              Severity: Major
              Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 2 hrs to fix
              resources/src/mediawiki.util/util.js on lines 242..256

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

              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 (k2 === -d || k2 !== d && v2[k2Offset - 1] < v2[k2Offset + 1]) {
                          x2 = v2[k2Offset + 1];
                        } else {
                          x2 = v2[k2Offset - 1] + 1;
                        }
              Severity: Major
              Found in resources/lib/qunitjs/qunit.js and 1 other location - About 2 hrs to fix
              resources/lib/qunitjs/qunit.js on lines 6609..6613

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

              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

              OO.ui.RadioSelectInputWidget.static.reusePreInfuseDOM = function ( node, config ) {
                  config = OO.ui.RadioSelectInputWidget.super.static.reusePreInfuseDOM( node, config );
                  // Cannot reuse the `<input type=radio>` set
                  delete config.$input;
                  return config;
              Severity: Major
              Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 2 hrs to fix
              resources/lib/ooui/oojs-ui-core.js on lines 11256..11261

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

              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

              OO.ui.CheckboxMultiselectInputWidget.static.reusePreInfuseDOM = function ( node, config ) {
                  config = OO.ui.CheckboxMultiselectInputWidget.super.static.reusePreInfuseDOM( node, config );
                  // Cannot reuse the `<input type=checkbox>` set
                  delete config.$input;
                  return config;
              Severity: Major
              Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 2 hrs to fix
              resources/lib/ooui/oojs-ui-core.js on lines 11065..11070

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

              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 (
                      !this.isDisabled() && (
                          e.which === OO.ui.MouseButtons.LEFT ||
                          e.which === OO.ui.Keys.SPACE ||
                          e.which === OO.ui.Keys.ENTER
              Severity: Major
              Found in resources/lib/ooui/oojs-ui-toolbars.js and 1 other location - About 2 hrs to fix
              resources/lib/ooui/oojs-ui-toolbars.js on lines 2278..2286

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

              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

                      return function () {
                          // Check how long it's been since the last time the function was
                          // called, and whether it's more or less than the requested throttle
                          // period. If it's less, run the function immediately. If it's more,
                          // set a timeout for the remaining time -- but don't replace an
              Severity: Major
              Found in resources/src/mediawiki.util/util.js and 1 other location - About 2 hrs to fix
              resources/lib/ooui/oojs-ui-core.js on lines 299..313

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

              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 (k1 === -d || k1 !== d && v1[k1Offset - 1] < v1[k1Offset + 1]) {
                          x1 = v1[k1Offset + 1];
                        } else {
                          x1 = v1[k1Offset - 1] + 1;
                        }
              Severity: Major
              Found in resources/lib/qunitjs/qunit.js and 1 other location - About 2 hrs to fix
              resources/lib/qunitjs/qunit.js on lines 6642..6646

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

              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 (
                      !this.isDisabled() && (
                          e.which === OO.ui.MouseButtons.LEFT ||
                          e.which === OO.ui.Keys.SPACE ||
                          e.which === OO.ui.Keys.ENTER
              Severity: Major
              Found in resources/lib/ooui/oojs-ui-toolbars.js and 1 other location - About 2 hrs to fix
              resources/lib/ooui/oojs-ui-toolbars.js on lines 1260..1282

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

              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

                  mw.widgets.UsersMultiselectWidget.prototype.onTagSelect = function () {
                      if ( this.hasInput && !this.input.getValue() ) {
                          OO.ui.TagMultiselectWidget.prototype.onTagSelect.apply( this, arguments );
                      }
                  };
              resources/src/mediawiki.widgets/mw.widgets.TitlesMultiselectWidget.js on lines 112..116

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

              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