wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 912 of 912 total issues

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

ve.ui.MWHeading4FormatTool = function VeUiMWHeading4FormatTool() {
    ve.ui.MWHeading4FormatTool.super.apply( this, arguments );
};
Severity: Major
Found in modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js and 12 other locations - About 40 mins to fix
editcheck/modules/EditCheckDialog.js on lines 117..119
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 35..37
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 53..55
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 89..91
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 107..109
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 136..138
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 37..39
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 66..68
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 95..97
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 124..126
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 153..155
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 182..184

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

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

ve.ui.MWHeading5FormatTool = function VeUiMWHeading5FormatTool() {
    ve.ui.MWHeading5FormatTool.super.apply( this, arguments );
};
Severity: Major
Found in modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js and 12 other locations - About 40 mins to fix
editcheck/modules/EditCheckDialog.js on lines 117..119
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 35..37
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 53..55
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 71..73
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 107..109
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 136..138
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 37..39
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 66..68
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 95..97
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 124..126
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 153..155
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 182..184

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

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

    $( '[accesskey=' + key + ']' ).each( ( i, el ) => {
        const $el = $( el );

        $el
            .attr( 'data-old-accesskey', $el.attr( 'accesskey' ) )
Severity: Minor
Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js and 1 other location - About 40 mins to fix
modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js on lines 574..580

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

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.exampleValue ) {
        $( '<p>' )
            .addClass( 've-ui-mwParameterPage-doc-example' )
            .text( ve.msg(
                'visualeditor-dialog-transclusion-param-example-long',
Severity: Minor
Found in modules/ve-mw/ui/pages/ve.ui.MWParameterPage.js and 1 other location - About 40 mins to fix
modules/ve-mw/ui/pages/ve.ui.MWParameterPage.js on lines 91..96

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

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

ve.dm.MWLanguageVariantNode.prototype.getVariantInfo = function () {
    return this.element.attributes.variantInfo;
};
Severity: Minor
Found in modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantNode.js and 1 other location - About 40 mins to fix
modules/ve-mw/dm/nodes/ve.dm.MWNumberedExternalLinkNode.js on lines 100..102

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

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

ve.ui.MWHeading6FormatTool = function VeUiMWHeading6FormatTool() {
    ve.ui.MWHeading6FormatTool.super.apply( this, arguments );
};
Severity: Major
Found in modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js and 12 other locations - About 40 mins to fix
editcheck/modules/EditCheckDialog.js on lines 117..119
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 35..37
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 53..55
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 71..73
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 89..91
modules/ve-mw/ui/tools/ve.ui.MWFormatTool.js on lines 136..138
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 37..39
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 66..68
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 95..97
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 124..126
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 153..155
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 182..184

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

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 ( offset > -1 ) {
                fragment = fragment.clone( new ve.dm.LinearSelection( new ve.Range( offset ) ) );
            }
Severity: Minor
Found in modules/ve-mw/dm/models/ve.dm.MWImageModel.js and 1 other location - About 40 mins to fix
modules/ve-mw/dm/models/ve.dm.MWImageModel.js on lines 488..490

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

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 ( !property || this.matchRdfaTypes.indexOf( property ) === -1 ) {
        // Fallback to first item if somehow unset
        property = this.matchRdfaTypes[ 0 ];
    }
Severity: Minor
Found in modules/ve-mw/dm/metaitems/ve.dm.MWFlaggedMetaItem.js and 1 other location - About 40 mins to fix
modules/ve-mw/dm/metaitems/ve.dm.MWFlaggedMetaItem.js on lines 35..38

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

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.defaultValue ) {
        $( '<p>' )
            .addClass( 've-ui-mwParameterPage-doc-default' )
            .text( ve.msg( 'visualeditor-dialog-transclusion-param-default', this.defaultValue ) )
            .appendTo( $doc );
Severity: Minor
Found in modules/ve-mw/ui/pages/ve.ui.MWParameterPage.js and 1 other location - About 40 mins to fix
modules/ve-mw/ui/pages/ve.ui.MWParameterPage.js on lines 98..106

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

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 ( !property || this.matchRdfaTypes.indexOf( property ) === -1 ) {
        // Fallback to first match if somehow unset
        property = this.matchRdfaTypes[ 0 ];
    }
Severity: Minor
Found in modules/ve-mw/dm/metaitems/ve.dm.MWFlaggedMetaItem.js and 1 other location - About 40 mins to fix
modules/ve-mw/dm/metaitems/ve.dm.MWFlaggedMetaItem.js on lines 47..50

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

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

ve.ui.MWWikitextPlainTextStringTransferHandler.static.types = [
    ...ve.ui.MWWikitextPlainTextStringTransferHandler.super.static.types,
    'text/x-wiki'
];
modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js on lines 34..37

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

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

    $( '[data-old-accesskey]' ).each( ( i, el ) => {
        const $el = $( el );

        $el
            .attr( 'accesskey', $el.attr( 'data-old-accesskey' ) )
Severity: Minor
Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js and 1 other location - About 40 mins to fix
modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js on lines 561..567

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

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 toggleWrapSelection has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

ve.ui.MWWikitextAction.prototype.toggleWrapSelection = function ( before, after, placeholder, expandOffsetsCallback, unwrapOffsetsCallback ) {
Severity: Minor
Found in modules/ve-mw/ui/actions/ve.ui.MWWikitextAction.js - About 35 mins to fix

    Function runScreenshotTest has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        function runScreenshotTest( lang, name, clientScript, padding, teardownScript ) {
    Severity: Minor
    Found in build/screenshots.js - About 35 mins to fix

      Function runMenuTask has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              runMenuTask: function ( done, tool, expanded, highlight, extraElements ) {
      Severity: Minor
      Found in build/screenshots-client/utils.js - About 35 mins to fix

        Method getHtmlInputTransformHelper has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                PageIdentity $page,
                string $html,
                int $oldid = null,
                string $etag = null,
                Bcp47Code $pageLanguage = null
        Severity: Minor
        Found in includes/DirectParsoidClient.php - About 35 mins to fix

          Function getVisualDiffGeneratorPromise has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  getVisualDiffGeneratorPromise: function ( oldIdOrPromise, newIdOrPromise, parseDocumentModulePromise, oldPageName, newPageName ) {
          Severity: Minor
          Found in modules/ve-mw/preinit/ve.init.mw.DiffLoader.js - About 35 mins to fix

            Method transformHTML has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    PageIdentity $page, Bcp47Code $targetLanguage, string $html, ?int $oldid, ?string $etag
            Severity: Minor
            Found in includes/DirectParsoidClient.php - About 35 mins to fix

              Method getHtmlOutputRendererHelper has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      PageIdentity $page,
                      ?RevisionRecord $revision = null,
                      Bcp47Code $pageLanguage = null,
                      bool $stash = false,
                      string $flavor = self::FLAVOR_DEFAULT
              Severity: Minor
              Found in includes/DirectParsoidClient.php - About 35 mins to fix

                Method onPreferencesFormPreSave has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function onPreferencesFormPreSave( $data, $form, $user, &$result, $oldUserOptions ) {
                Severity: Minor
                Found in includes/Hooks.php - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language