wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 912 of 912 total issues

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

ve.dm.MWMagicLinkNode.prototype.getMagicType = function () {
    const content = this.element.attributes.content,
        type = ve.dm.MWMagicLinkType.static.fromContent( content );
    return type.type;
};
Severity: Major
Found in modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js and 2 other locations - About 2 hrs to fix
modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js on lines 183..187
modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js on lines 205..209

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

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.init.mw.CollabTarget.prototype.getSurfaceClasses = function () {
    const classes = ve.init.mw.CollabTarget.super.prototype.getSurfaceClasses.call( this );
    return classes.concat( [ 'mw-body-content' ] );
};
Severity: Major
Found in modules/ve-mw-collab/ve.init.mw.CollabTarget.js and 1 other location - About 2 hrs to fix
modules/ve-mw-collab/ve.init.mw.MobileCollabTarget.js on lines 97..100

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

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.dm.MWMagicLinkNode.prototype.getCode = function () {
    const content = this.element.attributes.content,
        type = ve.dm.MWMagicLinkType.static.fromContent( content );
    return type.num;
};
Severity: Major
Found in modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js and 2 other locations - About 2 hrs to fix
modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js on lines 183..187
modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js on lines 194..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 83.

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.init.mw.ArticleTarget.prototype.getSurfaceClasses = function () {
    const classes = ve.init.mw.ArticleTarget.super.prototype.getSurfaceClasses.call( this );
    return [ ...classes, 'mw-body-content' ];
};
Severity: Major
Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js and 1 other location - About 2 hrs to fix
modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js on lines 264..267

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

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.dm.MWMagicLinkNode.prototype.getRel = function () {
    const content = this.element.attributes.content,
        type = ve.dm.MWMagicLinkType.static.fromContent( content );
    return type.rel;
};
Severity: Major
Found in modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js and 2 other locations - About 2 hrs to fix
modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js on lines 194..198
modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js on lines 205..209

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

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.init.mw.MobileArticleTarget.prototype.getSurfaceClasses = function () {
    const classes = ve.init.mw.MobileArticleTarget.super.prototype.getSurfaceClasses.call( this );
    return [ ...classes, 'content' ];
};
Severity: Major
Found in modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js and 1 other location - About 2 hrs to fix
modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js on lines 1780..1783

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

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.init.mw.MobileCollabTarget.prototype.getSurfaceClasses = function () {
    const classes = ve.init.mw.MobileCollabTarget.super.prototype.getSurfaceClasses.call( this );
    return classes.concat( [ 'content' ] );
};
Severity: Major
Found in modules/ve-mw-collab/ve.init.mw.MobileCollabTarget.js and 1 other location - About 2 hrs to fix
modules/ve-mw-collab/ve.init.mw.CollabTarget.js on lines 113..116

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

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

ve.init.mw.DesktopArticleTarget.prototype.teardown = function ( trackMechanism ) {
    // Event tracking
    let abortType, abortedMode;
    if ( trackMechanism ) {
        if ( this.activating ) {
Severity: Major
Found in modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js - About 2 hrs to fix

    Function initialize has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ve.ui.MWLinkAnnotationInspector.prototype.initialize = function () {
        // Properties
        this.allowProtocolInInternal = false;
        this.internalAnnotationInput = this.createInternalAnnotationInput();
        this.externalAnnotationInput = this.createExternalAnnotationInput();
    Severity: Major
    Found in modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js - About 2 hrs to fix

      Function OoUiOutlineControlsWidget has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ve.ui.MWTransclusionOutlineControlsWidget = function OoUiOutlineControlsWidget() {
          // Parent constructor
          ve.ui.MWTransclusionOutlineControlsWidget.super.call( this );
      
          // Mixin constructors
      Severity: Major
      Found in modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineControlsWidget.js - About 2 hrs to fix

        File ve.ui.MWCategoryWidget.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*!
         * VisualEditor UserInterface MWCategoryWidget class.
         *
         * @copyright See AUTHORS.txt
         * @license The MIT License (MIT); see LICENSE.txt
        Severity: Minor
        Found in modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js - About 2 hrs to fix

          Function escapeParameter has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ve.dm.MWTransclusionNode.static.escapeParameter = function ( param ) {
              let input = param,
                  output = '',
                  inNowiki = false,
                  bracketStack = 0,
          Severity: Major
          Found in modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js - About 2 hrs to fix

            Method onResourceLoaderGetConfigVars has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
                    $coreConfig = RequestContext::getMain()->getConfig();
                    $services = MediaWikiServices::getInstance();
                    $veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' );
                    $extensionRegistry = ExtensionRegistry::getInstance();
            Severity: Major
            Found in includes/Hooks.php - About 2 hrs to fix

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

              ve.dm.MWRedirectMetaItem.static.describeChange = function ( key, change ) {
                  if ( key === 'title' ) {
                      return ve.htmlMsg( 'visualeditor-changedesc-mwredirect', this.wrapText( 'del', change.from ), this.wrapText( 'ins', change.to ) );
                  }
                  return null;
              Severity: Major
              Found in modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js and 1 other location - About 2 hrs to fix
              modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.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 82.

              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.MWInternalLinkAnnotation.static.describeChange = function ( key, change ) {
                  if ( key === 'title' ) {
                      return ve.htmlMsg( 'visualeditor-changedesc-link-href', this.wrapText( 'del', change.from ), this.wrapText( 'ins', change.to ) );
                  }
                  return null;
              modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js on lines 59..64

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

              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

              Consider simplifying this complex logical expression.
              Open

                              if (
                                  $isAvailable &&
                                  $config->get( 'VisualEditorUseSingleEditTab' ) &&
                                  (
                                      $userOptionsLookup->getOption( $user, 'visualeditor-tabs' ) === 'prefer-ve' ||
              Severity: Critical
              Found in includes/Hooks.php - About 2 hrs to fix

                Function saveFail has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                ve.init.mw.ArticleTarget.prototype.saveFail = function ( doc, saveData, code, data ) {
                    this.pageDeletedWarning = false;
                
                    let handled = false;
                    // Handle empty response
                Severity: Major
                Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 2 hrs to fix

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

                  ve.ui.MWPreDialog.static.actions = [
                      ...ve.ui.MWPreDialog.super.static.actions,
                      {
                          action: 'convert',
                          label: OO.ui.deferMsg( 'visualeditor-mwpredialog-convert' ),
                  Severity: Major
                  Found in modules/ve-mw/ui/dialogs/ve.ui.MWPreDialog.js and 2 other locations - About 2 hrs to fix
                  modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js on lines 34..41
                  modules/ve-mw/ui/inspectors/ve.ui.MWMagicLinkNodeInspector.js on lines 34..41

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

                  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.MWMagicLinkNodeInspector.static.actions = [
                      ...ve.ui.MWMagicLinkNodeInspector.super.static.actions,
                      {
                          action: 'convert',
                          label: OO.ui.deferMsg( 'visualeditor-magiclinknodeinspector-convert-link' ),
                  modules/ve-mw/ui/dialogs/ve.ui.MWPreDialog.js on lines 38..45
                  modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js on lines 34..41

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

                  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.MWLinkNodeInspector.static.actions = [
                      ...ve.ui.MWLinkNodeInspector.super.static.actions,
                      {
                          action: 'convert',
                          label: OO.ui.deferMsg( 'visualeditor-linknodeinspector-add-label' ),
                  Severity: Major
                  Found in modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js and 2 other locations - About 2 hrs to fix
                  modules/ve-mw/ui/dialogs/ve.ui.MWPreDialog.js on lines 38..45
                  modules/ve-mw/ui/inspectors/ve.ui.MWMagicLinkNodeInspector.js on lines 34..41

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language