wikimedia/mediawiki-extensions-VisualEditor

View on GitHub
modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js

Summary

Maintainability
F
1 wk
Test Coverage

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

/*!
 * VisualEditor user interface MWMediaDialog class.
 *
 * @copyright See AUTHORS.txt
 * @license The MIT License (MIT); see LICENSE.txt
Severity: Major
Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 2 days to fix

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

    ve.ui.MWMediaDialog.prototype.initialize = function () {
        // Parent method
        ve.ui.MWMediaDialog.super.prototype.initialize.call( this );
    
        // Main layout
    Severity: Major
    Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 7 hrs to fix

      Function buildMediaInfoPanel has 192 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ve.ui.MWMediaDialog.prototype.buildMediaInfoPanel = function ( imageinfo ) {
          const contentDirection = this.getFragment().getDocument().getDir(),
              imageTitleText = imageinfo.title || imageinfo.canonicaltitle,
              imageTitle = new OO.ui.LabelWidget( {
                  label: mw.Title.newFromText( imageTitleText ).getNameText()
      Severity: Major
      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 7 hrs to fix

        Function getActionProcess has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ve.ui.MWMediaDialog.prototype.getActionProcess = function ( action ) {
            let handler;
        
            switch ( action ) {
                case 'change':
        Severity: Major
        Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 2 hrs to fix

          Function buildMediaInfoPanel has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          ve.ui.MWMediaDialog.prototype.buildMediaInfoPanel = function ( imageinfo ) {
              const contentDirection = this.getFragment().getDocument().getDir(),
                  imageTitleText = imageinfo.title || imageinfo.canonicaltitle,
                  imageTitle = new OO.ui.LabelWidget( {
                      label: mw.Title.newFromText( imageTitleText ).getNameText()
          Severity: Minor
          Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 2 hrs 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 confirmSelectedImage has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ve.ui.MWMediaDialog.prototype.confirmSelectedImage = function () {
              const obj = {},
                  info = this.selectedImageInfo;
          
              if ( info ) {
          Severity: Minor
          Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 1 hr to fix

            Function getSetupProcess has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            ve.ui.MWMediaDialog.prototype.getSetupProcess = function ( data ) {
                return ve.ui.MWMediaDialog.super.prototype.getSetupProcess.call( this, data )
                    .next( () => {
                        const isReadOnly = this.isReadOnly();
            
            
            Severity: Minor
            Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 1 hr to fix

              Function getSetupProcess has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              ve.ui.MWMediaDialog.prototype.getSetupProcess = function ( data ) {
                  return ve.ui.MWMediaDialog.super.prototype.getSetupProcess.call( this, data )
                      .next( () => {
                          const isReadOnly = this.isReadOnly();
              
              
              Severity: Minor
              Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 1 hr 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 switchPanels has 31 lines of code (exceeds 25 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 1 hr to fix

                Function getImportRules has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                ve.ui.MWMediaDialog.static.getImportRules = function () {
                    const rules = ve.copy( ve.init.target.constructor.static.importRules );
                    return ve.extendObject(
                        rules,
                        {
                Severity: Minor
                Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 1 hr to fix

                  Function resetCaption has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  ve.ui.MWMediaDialog.prototype.resetCaption = function () {
                      const doc = this.getFragment().getDocument();
                  
                      // Get existing caption. We only do this in setup, because the caption
                      // should not reset to original if the image is replaced or edited.
                  Severity: Minor
                  Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 1 hr to fix

                    Function attachImageModel has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    ve.ui.MWMediaDialog.prototype.attachImageModel = function () {
                        if ( this.imageModel ) {
                            this.imageModel.disconnect( this );
                            this.sizeWidget.disconnect( this );
                        }
                    Severity: Minor
                    Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 1 hr 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ve.ui.MWMediaDialog.prototype.initialize = function () {
                          // Parent method
                          ve.ui.MWMediaDialog.super.prototype.initialize.call( this );
                      
                          // Main layout
                      Severity: Minor
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 25 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 onPositionCheckboxChange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ve.ui.MWMediaDialog.prototype.onPositionCheckboxChange = function ( isSelected ) {
                          const currentModelAlignment = this.imageModel.getAlignment();
                      
                          this.positionSelect.setDisabled( !isSelected );
                          this.checkChanged();
                      Severity: Minor
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 25 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 resetCaption has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ve.ui.MWMediaDialog.prototype.resetCaption = function () {
                          const doc = this.getFragment().getDocument();
                      
                          // Get existing caption. We only do this in setup, because the caption
                          // should not reset to original if the image is replaced or edited.
                      Severity: Minor
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 25 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

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

                      ve.ui.MWMediaDialog.prototype.onSearchQueryClear = function () {
                          ve.track( 'activity.' + this.constructor.static.name, {
                              action: 'search-clear-query'
                          } );
                      };
                      Severity: Major
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 1 hr to fix
                      modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js on lines 192..194

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

                      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

                              case 'cancelchoose':
                                  handler = function () {
                                      this.switchPanels( 'search' );
                                  };
                                  ve.track( 'activity.' + this.constructor.static.name, {
                      Severity: Major
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 1 hr to fix
                      modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js on lines 1373..1381

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

                      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

                              case 'change':
                                  handler = function () {
                                      this.switchPanels( 'search' );
                                  };
                      
                      
                      Severity: Major
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 1 hr to fix
                      modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js on lines 1393..1400

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

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                          this.typeFieldset = new OO.ui.FieldsetLayout( {
                              $overlay: this.$overlay,
                              label: ve.msg( 'visualeditor-dialog-media-type-section' ),
                              help: ve.msg( 'visualeditor-dialog-media-type-section-help' )
                          } );
                      Severity: Major
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 1 hr to fix
                      modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js on lines 323..327

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

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                          this.sizeFieldset = new OO.ui.FieldsetLayout( {
                              $overlay: this.$overlay,
                              label: ve.msg( 'visualeditor-dialog-media-size-section' ),
                              help: ve.msg( 'visualeditor-dialog-media-size-section-help' )
                          } );
                      Severity: Major
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 1 hr to fix
                      modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js on lines 308..312

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

                      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

                          const positionFieldset = new OO.ui.FieldsetLayout( {
                              $overlay: this.$overlay,
                              label: ve.msg( 'visualeditor-dialog-media-position-section' ),
                              help: ve.msg( 'visualeditor-dialog-media-position-section-help' )
                          } );
                      Severity: Major
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 1 hr to fix
                      modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js on lines 243..247

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

                      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

                          const altTextFieldset = new OO.ui.FieldsetLayout( {
                              $overlay: this.$overlay,
                              label: ve.msg( 'visualeditor-dialog-media-alttext-section' ),
                              help: ve.msg( 'visualeditor-dialog-media-alttext-section-help' )
                          } );
                      Severity: Major
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 1 hr to fix
                      modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js on lines 264..268

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

                      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.MWMediaDialog.prototype.onUploadValid = function ( isValid ) {
                          this.actions.setAbilities( { upload: isValid } );
                      };
                      Severity: Minor
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 55 mins to fix
                      modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js on lines 484..486

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

                      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.MWMediaDialog.prototype.onInfoValid = function ( isValid ) {
                          this.actions.setAbilities( { save: isValid } );
                      };
                      Severity: Minor
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 55 mins to fix
                      modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js on lines 475..477

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

                      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.MWMediaDialog.static.excludeCommands = [
                          // No formatting
                          'paragraph',
                          'heading1',
                          'heading2',
                      Severity: Minor
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 35 mins to fix
                      modules/ve-mw/ui/inspectors/ve.ui.MWLanguageVariantInspector.js on lines 57..78

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

                      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