wikimedia/mediawiki-extensions-VisualEditor

View on GitHub
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js

Summary

Maintainability
D
2 days
Test Coverage

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

    ve.ui.wikitextCommandRegistry.register(
        new ve.ui.Command(
            'number', 'mwWikitext', 'wrapLine',
            { args: [ '# ', '', OO.ui.deferMsg( 'visualeditor-listbutton-number-tooltip' ), unlist.bind( this, '#' ) ], supportedSelections: [ 'linear' ] }
        )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 1 other location - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 213..218

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

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.wikitextCommandRegistry.register(
        new ve.ui.Command(
            'bullet', 'mwWikitext', 'wrapLine',
            { args: [ '* ', '', OO.ui.deferMsg( 'visualeditor-listbutton-bullet-tooltip' ), unlist.bind( this, '*' ) ], supportedSelections: [ 'linear' ] }
        )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 1 other location - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 207..212

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

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

ve.ui.wikitextCommandRegistry.register(
    new ve.ui.Command(
        'code', 'mwWikitext', 'toggleWrapSelection',
        { args: [ '<code>', '</code>', OO.ui.deferMsg( 'visualeditor-annotationbutton-code-tooltip' ) ], supportedSelections: [ 'linear' ] }
    )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 8 other locations - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 104..109
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 110..115
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 116..121
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 122..127
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 128..133
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 134..139
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 193..198
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 222..227

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

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

ve.ui.wikitextCommandRegistry.register(
    new ve.ui.Command(
        'subscript', 'mwWikitext', 'toggleWrapSelection',
        { args: [ '<sub>', '</sub>', OO.ui.deferMsg( 'visualeditor-annotationbutton-subscript-tooltip' ) ], supportedSelections: [ 'linear' ] }
    )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 8 other locations - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 98..103
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 104..109
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 110..115
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 122..127
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 128..133
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 134..139
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 193..198
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 222..227

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

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

ve.ui.wikitextCommandRegistry.register(
    new ve.ui.Command(
        'strikethrough', 'mwWikitext', 'toggleWrapSelection',
        { args: [ '<s>', '</s>', OO.ui.deferMsg( 'visualeditor-annotationbutton-strikethrough-tooltip' ) ], supportedSelections: [ 'linear' ] }
    )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 8 other locations - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 98..103
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 110..115
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 116..121
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 122..127
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 128..133
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 134..139
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 193..198
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 222..227

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

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

ve.ui.wikitextCommandRegistry.register(
    new ve.ui.Command(
        'underline', 'mwWikitext', 'toggleWrapSelection',
        { args: [ '<u>', '</u>', OO.ui.deferMsg( 'visualeditor-annotationbutton-underline-tooltip' ) ], supportedSelections: [ 'linear' ] }
    )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 8 other locations - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 98..103
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 104..109
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 116..121
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 122..127
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 128..133
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 134..139
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 193..198
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 222..227

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

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

ve.ui.wikitextCommandRegistry.register(
    new ve.ui.Command(
        'small', 'mwWikitext', 'toggleWrapSelection',
        { args: [ '<small>', '</small>', OO.ui.deferMsg( 'visualeditor-annotationbutton-small-tooltip' ) ], supportedSelections: [ 'linear' ] }
    )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 8 other locations - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 98..103
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 104..109
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 110..115
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 116..121
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 122..127
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 128..133
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 193..198
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 222..227

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

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

ve.ui.wikitextCommandRegistry.register(
    new ve.ui.Command(
        'big', 'mwWikitext', 'toggleWrapSelection',
        { args: [ '<big>', '</big>', OO.ui.deferMsg( 'visualeditor-annotationbutton-big-tooltip' ) ], supportedSelections: [ 'linear' ] }
    )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 8 other locations - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 98..103
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 104..109
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 110..115
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 116..121
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 122..127
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 134..139
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 193..198
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 222..227

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

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

ve.ui.wikitextCommandRegistry.register(
    new ve.ui.Command(
        'comment', 'mwWikitext', 'toggleWrapSelection',
        { args: [ '<!-- ', ' -->', OO.ui.deferMsg( 'visualeditor-commentinspector-title' ) ], supportedSelections: [ 'linear' ] }
    )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 8 other locations - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 98..103
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 104..109
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 110..115
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 116..121
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 122..127
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 128..133
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 134..139
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 193..198

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

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

ve.ui.wikitextCommandRegistry.register(
    new ve.ui.Command(
        'superscript', 'mwWikitext', 'toggleWrapSelection',
        { args: [ '<sup>', '</sup>', OO.ui.deferMsg( 'visualeditor-annotationbutton-superscript-tooltip' ) ], supportedSelections: [ 'linear' ] }
    )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 8 other locations - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 98..103
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 104..109
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 110..115
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 116..121
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 128..133
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 134..139
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 193..198
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 222..227

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

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

    ve.ui.wikitextCommandRegistry.register(
        new ve.ui.Command(
            'blockquote', 'mwWikitext', 'toggleWrapSelection',
            { args: [ '<blockquote>', '</blockquote>', OO.ui.deferMsg( 'visualeditor-formatdropdown-format-blockquote' ) ], supportedSelections: [ 'linear' ] }
        )
Severity: Major
Found in modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js and 8 other locations - About 1 hr to fix
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 98..103
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 104..109
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 110..115
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 116..121
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 122..127
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 128..133
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 134..139
modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js on lines 222..227

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

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

There are no issues that match your filters.

Category
Status