wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

        if ( config.fullMonthNames && !config.shortMonthNames ) {
            config.shortMonthNames = {};
            // eslint-disable-next-line no-jquery/no-each-util
            $.each( config.fullMonthNames, ( k, v ) => {
                config.shortMonthNames[ k ] = v.slice( 0, 3 );
resources/src/mediawiki.widgets.datetime/ProlepticGregorianDateTimeFormatter.js on lines 60..66

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

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 ( config.shortDayNames && !config.dayLetters ) {
            config.dayLetters = [];
            // eslint-disable-next-line no-jquery/no-each-util
            $.each( config.shortDayNames, ( k, v ) => {
                config.dayLetters[ k ] = v.slice( 0, 1 );
resources/src/mediawiki.widgets.datetime/ProlepticGregorianDateTimeFormatter.js on lines 53..59

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

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 ( config.fullDayNames && !config.dayLetters ) {
            config.dayLetters = [];
            // eslint-disable-next-line no-jquery/no-each-util
            $.each( config.fullDayNames, ( k, v ) => {
                config.dayLetters[ k ] = v.slice( 0, 1 );
resources/src/mediawiki.widgets.datetime/ProlepticGregorianDateTimeFormatter.js on lines 46..52

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

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.fullDayNames && !this.shortDayNames ) {
            this.shortDayNames = {};
            // eslint-disable-next-line no-jquery/no-each-util
            $.each( this.fullDayNames, ( k, v ) => {
                this.shortDayNames[ k ] = v.slice( 0, 3 );
resources/src/mediawiki.widgets.datetime/ProlepticGregorianDateTimeFormatter.js on lines 173..179

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

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 (checkCrossAxis) {
          const minSide = crossAxis === "y" ? "top" : "left";
          const maxSide = crossAxis === "y" ? "bottom" : "right";
          const min2 = crossAxisCoord + overflow[minSide];
          const max2 = crossAxisCoord - overflow[maxSide];
Severity: Major
Found in resources/lib/codex/codex.js and 1 other location - About 2 hrs to fix
resources/lib/codex/codex.js on lines 4106..4112

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

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 ( config.fullDayNames && !config.shortDayNames ) {
            config.shortDayNames = {};
            // eslint-disable-next-line no-jquery/no-each-util
            $.each( config.fullDayNames, ( k, v ) => {
                config.shortDayNames[ k ] = v.slice( 0, 3 );
resources/src/mediawiki.widgets.datetime/ProlepticGregorianDateTimeFormatter.js on lines 39..45

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

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 (checkMainAxis) {
          const minSide = mainAxis === "y" ? "top" : "left";
          const maxSide = mainAxis === "y" ? "bottom" : "right";
          const min2 = mainAxisCoord + overflow[minSide];
          const max2 = mainAxisCoord - overflow[maxSide];
Severity: Major
Found in resources/lib/codex/codex.js and 1 other location - About 2 hrs to fix
resources/lib/codex/codex.js on lines 4113..4119

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

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.fullMonthNames && !this.shortMonthNames ) {
            this.shortMonthNames = {};
            // eslint-disable-next-line no-jquery/no-each-util
            $.each( this.fullMonthNames, ( k, v ) => {
                this.shortMonthNames[ k ] = v.slice( 0, 3 );
resources/src/mediawiki.widgets.datetime/ProlepticGregorianDateTimeFormatter.js on lines 194..200

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

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

    addPortletLink: function ( portletId, href, text, id, tooltip, accesskey, nextnode ) {
        if ( !portletId ) {
            // Avoid confusing id="undefined" lookup
            return null;
        }
Severity: Major
Found in resources/src/mediawiki.util/util.js - About 2 hrs to fix

    Function match has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function match(expectation, message) {
                var m = sinon.create(matcher);
                var type = sinon.typeOf(expectation);
                switch (type) {
                case "object":
    Severity: Major
    Found in resources/lib/sinonjs/sinon.js - About 2 hrs to fix

      Function createDuration has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function createDuration(input, key) {
              var duration = input,
                  // matching against regexp is expensive, do it on demand
                  match = null,
                  sign,
      Severity: Major
      Found in resources/lib/moment/moment.js - About 2 hrs to fix

        Function configFromArray has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function configFromArray(config) {
                var i,
                    date,
                    input = [],
                    currentDate,
        Severity: Major
        Found in resources/lib/moment/moment.js - About 2 hrs to fix

          Function OoUiNumberInputWidget has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          OO.ui.NumberInputWidget = function OoUiNumberInputWidget( config ) {
              const $field = $( '<div>' ).addClass( 'oo-ui-numberInputWidget-field' );
          
              // Configuration initialization
              config = Object.assign( {
          Severity: Major
          Found in resources/lib/ooui/oojs-ui-core.js - About 2 hrs to fix

            Function drag has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                drag: function(event, ui) {
            
                    var inst = $(this).data("draggable"), that = this;
            
                    var checkPos = function(o) {
            Severity: Major
            Found in resources/lib/jquery.ui/jquery.ui.draggable.js - About 2 hrs to fix

              Function _create has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _create: function() {
                      var that = this,
                          options = this.options,
                          active = options.active,
                          locationHash = location.hash.substring( 1 );
              Severity: Major
              Found in resources/lib/jquery.ui/jquery.ui.tabs.js - About 2 hrs to fix

                Function _mouseStart has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _mouseStart: function(event, overrideHandle, noActivation) {
                
                        var o = this.options;
                        this.currentContainer = this;
                
                
                Severity: Major
                Found in resources/lib/jquery.ui/jquery.ui.sortable.js - About 2 hrs to fix

                  Method resetNotificationTimestamp has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function resetNotificationTimestamp(
                          UserIdentity $user,
                          $title,
                          $force = '',
                          $oldid = 0
                  Severity: Major
                  Found in includes/watchlist/WatchedItemStore.php - About 2 hrs to fix

                    Method doImport has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function doImport() {
                            $this->syntaxCheckXML();
                    
                            // Calls to reader->read need to be wrapped in calls to
                            // libxml_disable_entity_loader() to avoid local file
                    Severity: Major
                    Found in includes/import/WikiImporter.php - About 2 hrs to fix

                      Method getMultiNotice has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getMultiNotice() {
                              // The notice only make sense if we are diffing two saved revisions of the same page.
                              if (
                                  !$this->mOldRevisionRecord || !$this->mNewRevisionRecord
                                  || !$this->mOldPage || !$this->mNewPage
                      Severity: Major
                      Found in includes/diff/DifferenceEngine.php - About 2 hrs to fix

                        Method convertGrammar has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function convertGrammar( $word, $case ) {
                                $grammarForms =
                                    MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
                                if ( isset( $grammarForms['os'][$case][$word] ) ) {
                                    return $grammarForms['os'][$case][$word];
                        Severity: Major
                        Found in includes/languages/LanguageOs.php - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language