wikimedia/mediawiki-extensions-UploadWizard

View on GitHub
resources/deed/uw.deed.OwnWork.js

Summary

Maintainability
F
5 days
Test Coverage

Function UWDeedOwnWork has 285 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    uw.deed.OwnWork = function UWDeedOwnWork( config, uploads, api ) {
        var self = this,
            prefAuthName = mw.user.options.get( 'upwiz_licensename' ),
            revealOptionContent = function ( $parent, $child ) {
                // hide sub-content for all options
Severity: Major
Found in resources/deed/uw.deed.OwnWork.js - About 1 day to fix

    File uw.deed.OwnWork.js has 449 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * This file is part of the MediaWiki extension UploadWizard.
     *
     * UploadWizard is free software: you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
    Severity: Minor
    Found in resources/deed/uw.deed.OwnWork.js - About 6 hrs to fix

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

                      new OO.ui.RadioOptionWidget( {
                          label: $( '<div>' )
                              .msg(
                                  'mwe-upwiz-source-ownwork-origin-option-others-unknown',
                                  this.uploadCount,
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 5 hrs to fix
      resources/deed/uw.deed.OwnWork.js on lines 178..200

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

      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

                      new OO.ui.RadioOptionWidget( {
                          label: $( '<div>' )
                              .msg(
                                  'mwe-upwiz-source-ownwork-origin-option-others-copyrighted',
                                  this.uploadCount,
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 5 hrs to fix
      resources/deed/uw.deed.OwnWork.js on lines 201..223

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

      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

              if ( text === '' ) {
                  errors.push( mw.message( 'mwe-upwiz-error-signature-blank' ) );
              } else if ( text.length < minLength ) {
                  errors.push( mw.message( 'mwe-upwiz-error-signature-too-short', minLength ) );
              } else if ( text.length > maxLength ) {
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 2 other locations - About 3 hrs to fix
      resources/deed/uw.deed.ThirdParty.js on lines 55..61
      resources/deed/uw.deed.ThirdParty.js on lines 99..105

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

      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

              this.originRadioField = new uw.FieldLayout( this.originRadio, {
                  label: $( '<div>' ).append(
                      $( '<li>' )
                          .addClass( 'mwe-upwiz-label-title' )
                          .append(
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 2 other locations - About 2 hrs to fix
      resources/deed/uw.deed.OwnWork.js on lines 289..296
      resources/deed/uw.deed.ThirdParty.js on lines 167..174

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

      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

              this.licenseInputField = new uw.FieldLayout( this.licenseInput, {
                  label: $( '<div>' ).append(
                      $( '<li>' )
                          .addClass( 'mwe-upwiz-label-title' )
                          .append( mw.message( 'mwe-upwiz-source-ownwork-question', this.uploadCount, mw.user ).parseDom() )
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 2 other locations - About 2 hrs to fix
      resources/deed/uw.deed.OwnWork.js on lines 268..281
      resources/deed/uw.deed.ThirdParty.js on lines 167..174

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

      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.originOthersRadio.on( 'select', ( selectedOption ) => {
                  revealOptionContent( self.originOthersRadio.$element, selectedOption.$element );
      
                  // let's also emit a 'change' event on the parent radio to satisfy the listener
                  // that checks and shows/hides an error message
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 1 hr to fix
      resources/deed/uw.deed.OwnWork.js on lines 324..330

      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.purposeRadio.on( 'select', ( selectedOption ) => {
                  revealOptionContent( self.purposeRadio.$element, selectedOption.$element );
      
                  // let's also emit a 'change' event to satisfy the listener that checks
                  // and shows/hides an error message
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 1 hr to fix
      resources/deed/uw.deed.OwnWork.js on lines 227..233

      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

          uw.deed.OwnWork.prototype.getAuthorWarnings = function () {
              return $.Deferred().resolve( [] ).promise();
          };
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 1 hr to fix
      resources/deed/uw.deed.OwnWork.js on lines 570..572

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

      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

          uw.deed.OwnWork.prototype.getOwnWorkWarnings = function () {
              return $.Deferred().resolve( [] ).promise();
          };
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 1 hr to fix
      resources/deed/uw.deed.OwnWork.js on lines 599..601

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

      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

                  } else if ( aiInputValue.length > this.config.maxAiInputLength ) {
                      errors.push( mw.message( 'mwe-upwiz-error-too-long', this.config.maxAiInputLength ) );
                  }
      Severity: Minor
      Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 50 mins to fix
      resources/details/uw.SingleLanguageInputWidget.js on lines 161..163

      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

                      new OO.ui.RadioOptionWidget( {
                          label: mw.message(
                              'mwe-upwiz-source-ownwork-origin-option-others-nocopyright',
                              this.uploadCount,
                              mw.user
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 3 other locations - About 40 mins to fix
      resources/deed/uw.deed.OwnWork.js on lines 66..73
      resources/deed/uw.deed.OwnWork.js on lines 300..303
      resources/deed/uw.deed.ThirdParty.js on lines 141..144

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

      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

                      new OO.ui.RadioOptionWidget( {
                          label: mw.message( 'mwe-upwiz-source-ownwork-purpose-option-knowledge', this.uploadCount, mw.user ).text(),
                          data: 'knowledge'
                      } ),
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 3 other locations - About 40 mins to fix
      resources/deed/uw.deed.OwnWork.js on lines 66..73
      resources/deed/uw.deed.OwnWork.js on lines 170..177
      resources/deed/uw.deed.ThirdParty.js on lines 141..144

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

      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

                      new OO.ui.RadioOptionWidget( {
                          label: mw.message(
                              'mwe-upwiz-source-ownwork-origin-option-own',
                              this.uploadCount,
                              mw.user
      Severity: Major
      Found in resources/deed/uw.deed.OwnWork.js and 3 other locations - About 40 mins to fix
      resources/deed/uw.deed.OwnWork.js on lines 170..177
      resources/deed/uw.deed.OwnWork.js on lines 300..303
      resources/deed/uw.deed.ThirdParty.js on lines 141..144

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

      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