wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 912 of 912 total issues

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

ve.dm.MWLanguageVariantHiddenNode = function VeDmMWLanguageVariantHiddenNode() {
    // Parent constructor
    ve.dm.MWLanguageVariantHiddenNode.super.apply( this, arguments );
};
Severity: Major
Found in modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantHiddenNode.js and 10 other locations - About 50 mins to fix
modules/ve-mw/dm/nodes/ve.dm.MWGalleryCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWImageCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantBlockNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantInlineNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWTransclusionBlockNode.js on lines 17..20
modules/ve-mw/dm/nodes/ve.dm.MWTransclusionInlineNode.js on lines 17..20
modules/ve-mw/ui/actions/ve.ui.MWSaveDialogAction.js on lines 81..84
modules/ve-mw/ui/tools/ve.ui.MWBackTool.js on lines 11..14
modules/ve-mw/ui/tools/ve.ui.MWSignatureTool.js on lines 17..20

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

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

ve.dm.MWLanguageVariantInlineNode = function VeDmMWLanguageVariantInlineNode() {
    // Parent constructor
    ve.dm.MWLanguageVariantInlineNode.super.apply( this, arguments );
};
Severity: Major
Found in modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantInlineNode.js and 10 other locations - About 50 mins to fix
modules/ve-mw/dm/nodes/ve.dm.MWGalleryCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWImageCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantBlockNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantHiddenNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWTransclusionBlockNode.js on lines 17..20
modules/ve-mw/dm/nodes/ve.dm.MWTransclusionInlineNode.js on lines 17..20
modules/ve-mw/ui/actions/ve.ui.MWSaveDialogAction.js on lines 81..84
modules/ve-mw/ui/tools/ve.ui.MWBackTool.js on lines 11..14
modules/ve-mw/ui/tools/ve.ui.MWSignatureTool.js on lines 17..20

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

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

ve.ui.commandRegistry.register(
    new ve.ui.Command(
        'meta/categories', 'window', 'open',
        { args: [ 'meta', { page: 'categories' } ] }
    )
Severity: Major
Found in modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js and 3 other locations - About 50 mins to fix
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 108..113
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 137..142
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 166..171

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

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

ve.ui.commandRegistry.register(
    new ve.ui.Command(
        'meta/settings', 'window', 'open',
        { args: [ 'meta', { page: 'settings' } ] }
    )
Severity: Major
Found in modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js and 3 other locations - About 50 mins to fix
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 79..84
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 137..142
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 166..171

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

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

ve.dm.MWLanguageVariantBlockNode = function VeDmMWLanguageVariantBlockNode() {
    // Parent constructor
    ve.dm.MWLanguageVariantBlockNode.super.apply( this, arguments );
};
Severity: Major
Found in modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantBlockNode.js and 10 other locations - About 50 mins to fix
modules/ve-mw/dm/nodes/ve.dm.MWGalleryCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWImageCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantHiddenNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantInlineNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWTransclusionBlockNode.js on lines 17..20
modules/ve-mw/dm/nodes/ve.dm.MWTransclusionInlineNode.js on lines 17..20
modules/ve-mw/ui/actions/ve.ui.MWSaveDialogAction.js on lines 81..84
modules/ve-mw/ui/tools/ve.ui.MWBackTool.js on lines 11..14
modules/ve-mw/ui/tools/ve.ui.MWSignatureTool.js on lines 17..20

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

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

ve.ui.sequenceRegistry.register(
    new ve.ui.Sequence(
        'autolinkMagicLinkRfcPmid', 'autolinkMagicLink', /\b(RFC|PMID)\s+[0-9]+$/, 0,
        {
            setSelection: true,
Severity: Major
Found in modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js and 2 other locations - About 50 mins to fix
modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js on lines 174..183
modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js on lines 184..193

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

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

ve.dm.MWTransclusionBlockNode = function VeDmMWTransclusionBlockNode() {
    // Parent constructor
    ve.dm.MWTransclusionBlockNode.super.apply( this, arguments );
};
Severity: Major
Found in modules/ve-mw/dm/nodes/ve.dm.MWTransclusionBlockNode.js and 10 other locations - About 50 mins to fix
modules/ve-mw/dm/nodes/ve.dm.MWGalleryCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWImageCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantBlockNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantHiddenNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantInlineNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWTransclusionInlineNode.js on lines 17..20
modules/ve-mw/ui/actions/ve.ui.MWSaveDialogAction.js on lines 81..84
modules/ve-mw/ui/tools/ve.ui.MWBackTool.js on lines 11..14
modules/ve-mw/ui/tools/ve.ui.MWSignatureTool.js on lines 17..20

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

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

ve.ui.commandRegistry.register(
    new ve.ui.Command(
        'meta/languages', 'window', 'open',
        { args: [ 'meta', { page: 'languages' } ] }
    )
Severity: Major
Found in modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js and 3 other locations - About 50 mins to fix
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 79..84
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 108..113
modules/ve-mw/ui/tools/ve.ui.MWMetaDialogTool.js on lines 137..142

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

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

ve.dm.MWImageCaptionNode = function VeDmMWImageCaptionNode() {
    // Parent constructor
    ve.dm.MWImageCaptionNode.super.apply( this, arguments );
};
Severity: Major
Found in modules/ve-mw/dm/nodes/ve.dm.MWImageCaptionNode.js and 10 other locations - About 50 mins to fix
modules/ve-mw/dm/nodes/ve.dm.MWGalleryCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageCaptionNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantBlockNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantHiddenNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantInlineNode.js on lines 18..21
modules/ve-mw/dm/nodes/ve.dm.MWTransclusionBlockNode.js on lines 17..20
modules/ve-mw/dm/nodes/ve.dm.MWTransclusionInlineNode.js on lines 17..20
modules/ve-mw/ui/actions/ve.ui.MWSaveDialogAction.js on lines 81..84
modules/ve-mw/ui/tools/ve.ui.MWBackTool.js on lines 11..14
modules/ve-mw/ui/tools/ve.ui.MWSignatureTool.js on lines 17..20

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

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.MWLanguageVariantDisabledInspector = function VeUiMWLanguageVariantDisabledInspector() {
    ve.ui.MWLanguageVariantDisabledInspector.super.apply( this, arguments );
};
Severity: Minor
Found in modules/ve-mw/ui/inspectors/ve.ui.MWLanguageVariantInspector.js and 1 other location - About 50 mins to fix
modules/ve-mw/ui/tools/ve.ui.MWTransclusionDialogTool.js on lines 17..19

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

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.MWEditModeVisualTool.prototype.switch = function () {
    this.toolbar.getTarget().switchToVisualEditor();
};
Severity: Minor
Found in modules/ve-mw/ui/tools/ve.ui.MWEditModeTool.js and 1 other location - About 50 mins to fix
modules/ve-mw/ui/tools/ve.ui.MWEditModeTool.js on lines 94..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 51.

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.MWTransclusionDialogTool = function VeUiMWTransclusionDialogTool() {
    ve.ui.MWTransclusionDialogTool.super.apply( this, arguments );
};
Severity: Minor
Found in modules/ve-mw/ui/tools/ve.ui.MWTransclusionDialogTool.js and 1 other location - About 50 mins to fix
modules/ve-mw/ui/inspectors/ve.ui.MWLanguageVariantInspector.js on lines 281..283

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

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.MWEditModeSourceTool.prototype.switch = function () {
    this.toolbar.getTarget().editSource();
};
Severity: Minor
Found in modules/ve-mw/ui/tools/ve.ui.MWEditModeTool.js and 1 other location - About 50 mins to fix
modules/ve-mw/ui/tools/ve.ui.MWEditModeTool.js on lines 68..70

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

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 getCanonicalParam has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

ve.ui.MWDefinedTransclusionContextItem.prototype.getCanonicalParam = function ( name ) {
    const params = this.tool.params || {};

    if ( Object.prototype.hasOwnProperty.call( params, name ) ) {
        const aliases = Array.isArray( params[ name ] ) ? params[ name ] : [ params[ name ] ];
Severity: Minor
Found in modules/ve-mw/ui/contextitems/ve.ui.MWDefinedTransclusionContextItem.js - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid deeply nested control flow statements.
Open

                    if ( reselect ) {
                        this.bookletLayout.focusPart( reselect );
                    }
Severity: Major
Found in modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js - About 45 mins to fix

    Function getActionProcess has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWExtensionDialog.prototype.getActionProcess = function ( action ) {
        if ( action === '' ) {
            if ( this.hasMeaningfulEdits() ) {
                // eslint-disable-next-line arrow-body-style
                return new OO.ui.Process( () => {
    Severity: Minor
    Found in modules/ve-mw/ui/dialogs/ve.ui.MWExtensionDialog.js - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function replacePageContent has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        html, categoriesHtml, displayTitle, lastModified, contentSub, sections
    Severity: Minor
    Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 45 mins to fix

      Function switchPanels has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      ve.ui.MWMediaDialog.prototype.switchPanels = function ( panel, noFocus ) {
          switch ( panel ) {
              case 'edit':
                  this.setSize( this.constructor.static.size );
                  // Set the edit panel
      Severity: Minor
      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function addPages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.addPages = function ( pages, index ) {
          const stackLayoutPages = this.stackLayout.getItems();
      
          // Remove pages with same names
          const remove = [];
      Severity: Minor
      Found in modules/ve-mw/ui/layouts/ve.ui.MWTwoPaneTransclusionDialogLayout.js - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function saveComplete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      ve.init.mw.ArticleTarget.prototype.saveComplete = function ( data ) {
          this.editSummaryValue = null;
          this.initialEditSummary = null;
      
          this.saveDeferred.resolve();
      Severity: Minor
      Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Severity
      Category
      Status
      Source
      Language