wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

        function makeRegexParser( regex ) {
            return function () {
                const matches = input.slice( pos ).match( regex );
                if ( matches === null ) {
                    return null;
Severity: Major
Found in resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js and 2 other locations - About 1 hr to fix
resources/lib/CLDRPluralRuleParser/CLDRPluralRuleParser.js on lines 186..198
resources/lib/jquery.i18n/src/jquery.i18n.parser.js on lines 135..147

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

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.WindowManager.prototype.isOpened = function ( win ) {
    return win === this.currentWindow && !!this.lifecycle &&
        this.lifecycle.isOpened();
};
Severity: Major
Found in resources/lib/ooui/oojs-ui-windows.js and 2 other locations - About 1 hr to fix
resources/lib/ooui/oojs-ui-windows.js on lines 1203..1206
resources/lib/ooui/oojs-ui-windows.js on lines 1214..1217

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

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

            function makeRegexParser( regex ) {
                return function () {
                    var matches = message.slice( pos ).match( regex );

                    if ( matches === null ) {
Severity: Major
Found in resources/lib/jquery.i18n/src/jquery.i18n.parser.js and 2 other locations - About 1 hr to fix
resources/lib/CLDRPluralRuleParser/CLDRPluralRuleParser.js on lines 186..198
resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js on lines 459..468

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

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

        this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
Severity: Major
Found in resources/lib/jquery.ui/jquery.ui.resizable.js and 1 other location - About 1 hr to fix
resources/lib/jquery.ui/jquery.ui.resizable.js on lines 259..259

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

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 (type == "SRATIONAL") {
                num = JpegMeta.parseSnum(endian, _binary_data, value_offset, 4);
                den = JpegMeta.parseSnum(endian, _binary_data, value_offset + 4, 4);
                value.push(new JpegMeta.Rational(num, den));
            }
Severity: Major
Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js and 1 other location - About 1 hr to fix
resources/src/mediawiki.libs.jpegmeta/jpegmeta.js on lines 610..614

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

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 ( $result.length === 0 && context.data.$container.find( '.suggestions-special' ).html() !== '' ) {
                        // No suggestion exists, go to the special one directly
                        $result = context.data.$container.find( '.suggestions-special' );
                    }
Severity: Major
Found in resources/src/jquery/jquery.suggestions.js and 1 other location - About 1 hr to fix
resources/src/jquery/jquery.suggestions.js on lines 195..201

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

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

        function makeStringParser( s ) {
            const len = s.length;
            return function () {
                let result = null;
                if ( input.slice( pos, pos + len ) === s ) {
Severity: Major
Found in resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js and 1 other location - About 1 hr to fix
resources/lib/jquery.i18n/src/jquery.i18n.parser.js on lines 120..133

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

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.WindowManager.prototype.isClosing = function ( win ) {
    return win === this.currentWindow && !!this.lifecycle &&
        this.lifecycle.isClosing();
};
Severity: Major
Found in resources/lib/ooui/oojs-ui-windows.js and 2 other locations - About 1 hr to fix
resources/lib/ooui/oojs-ui-windows.js on lines 1203..1206
resources/lib/ooui/oojs-ui-windows.js on lines 1225..1228

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

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 (type == "RATIONAL") {
                num = JpegMeta.parseNum(endian, _binary_data, value_offset, 4);
                den = JpegMeta.parseNum(endian, _binary_data, value_offset + 4, 4);
                value.push(new JpegMeta.Rational(num, den));
            }
Severity: Major
Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js and 1 other location - About 1 hr to fix
resources/src/mediawiki.libs.jpegmeta/jpegmeta.js on lines 615..619

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

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

            function makeStringParser( s ) {
                var len = s.length;

                return function () {
                    var result = null;
Severity: Major
Found in resources/lib/jquery.i18n/src/jquery.i18n.parser.js and 1 other location - About 1 hr to fix
resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js on lines 438..448

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

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

                    } else if (
                        $result.length === 0 &&
                        context.data.$container.find( '.suggestions-special' ).html() !== ''
                    ) {
                        // We were at the last item, jump to the specials!
Severity: Major
Found in resources/src/jquery/jquery.suggestions.js and 1 other location - About 1 hr to fix
resources/src/jquery/jquery.suggestions.js on lines 180..183

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

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

        this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
Severity: Major
Found in resources/lib/jquery.ui/jquery.ui.resizable.js and 1 other location - About 1 hr to fix
resources/lib/jquery.ui/jquery.ui.resizable.js on lines 258..258

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

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

    function handleParseResponse( config, response ) {
        let $content;

        // Js config variables and modules.
        if ( response.parse.jsconfigvars ) {
Severity: Minor
Found in resources/src/mediawiki.page.preview.js - About 1 hr to fix

    Function MwWidgetsDatetimeProlepticGregorianDateTimeFormatter has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        mw.widgets.datetime.ProlepticGregorianDateTimeFormatter = function MwWidgetsDatetimeProlepticGregorianDateTimeFormatter( config ) {
            this.constructor.static.setupDefaults();
    
            config = Object.assign( {
                weekStartsOn: 0,

      Function hook has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      mw.hook = function ( name ) {
          return hooks[ name ] || ( hooks[ name ] = ( function () {
              let memory;
              const fns = [];
              function rethrow( e ) {
      Severity: Minor
      Found in resources/src/mediawiki.base/mediawiki.base.js - About 1 hr to fix

        Function buildIndex has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function buildIndex() {
                    index = {};
                    const $fields = tabs.contentPanel.$element.find( '[class^=mw-htmlform-field-]:not( .mw-prefs-search-noindex )' );
                    const $descFields = $fields.filter(
                        '.oo-ui-fieldsetLayout-group > .oo-ui-widget > .mw-htmlform-field-HTMLInfoField'
        Severity: Minor
        Found in resources/src/mediawiki.special.preferences.ooui/tabs.js - About 1 hr to fix

          Function findMatches has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          FiltersViewModel.prototype.findMatches = function ( query, returnFlat ) {
              const result = {},
                  flatResult = [],
                  view = this.getViewByTrigger( query.slice( 0, 1 ) ),
                  items = this.getFiltersByView( view );
          Severity: Minor
          Found in resources/src/mediawiki.rcfilters/dm/FiltersViewModel.js - About 1 hr to fix

            Function renderInfoForm has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                mw.Upload.BookletLayout.prototype.renderInfoForm = function () {
                    let fieldset;
            
                    this.filePreview = new OO.ui.Widget( {
                        classes: [ 'mw-upload-bookletLayout-filePreview' ]
            Severity: Minor
            Found in resources/src/mediawiki.Upload.BookletLayout/BookletLayout.js - About 1 hr to fix

              Function diffLineMode has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  DiffMatchPatch.prototype.diffLineMode = function (text1, text2, deadline) {
                    var a, diffs, linearray, pointer, countInsert, countDelete, textInsert, textDelete, j;
              
                    // Scan the text on a line-by-line basis first.
                    a = this.diffLinesToChars(text1, text2);
              Severity: Minor
              Found in resources/lib/qunitjs/qunit.js - About 1 hr to fix

                Function data has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    data: function( key, value ) {
                        var i, name, data,
                            elem = this[ 0 ],
                            attrs = elem && elem.attributes;
                
                
                Severity: Minor
                Found in resources/lib/jquery/jquery.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language