wikimedia/mediawiki-extensions-UploadWizard

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

Summary

Maintainability
F
3 days
Test Coverage

Function UWDeedThirdParty has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    uw.deed.ThirdParty = function UWDeedThirdParty( config, uploads, api ) {
        var deed = this;

        uw.deed.Abstract.call( this, 'thirdparty', config, uploads );

Severity: Major
Found in resources/deed/uw.deed.ThirdParty.js - About 4 hrs to fix

    File uw.deed.ThirdParty.js has 290 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.ThirdParty.js - About 2 hrs to fix

      Function setFormFields has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          uw.deed.ThirdParty.prototype.setFormFields = function ( $selector ) {
              var $formFields = $( '<div>' ).addClass( 'mwe-upwiz-deed-form-internal' ), self = this;
      
              this.$form = $( '<form>' );
      
      
      Severity: Major
      Found in resources/deed/uw.deed.ThirdParty.js - About 2 hrs to fix

        Function updateAuthorFieldForAI has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            uw.deed.ThirdParty.prototype.updateAuthorFieldForAI = function () {
                if ( this.templateOptions.aiGenerated.input.isSelected() ) {
                    this.authorInputField.setLabel(
                        $( '<li>' )
                            .addClass( 'mwe-upwiz-label-title' )
        Severity: Minor
        Found in resources/deed/uw.deed.ThirdParty.js - About 1 hr to fix

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

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

          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

                      if ( text === '' ) {
                          errors.push( mw.message( 'mwe-upwiz-error-question-blank' ) );
                      } else if ( text.length < minLength ) {
                          errors.push( mw.message( 'mwe-upwiz-error-too-short', minLength ) );
                      } else if ( text.length > maxLength ) {
          Severity: Major
          Found in resources/deed/uw.deed.ThirdParty.js and 2 other locations - About 3 hrs to fix
          resources/deed/uw.deed.OwnWork.js on lines 585..591
          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.complianceField = new uw.FieldLayout( this.complianceCheck, {
                      label: $( '<div>' ).append(
                          $( '<li>' )
                              .addClass( 'mwe-upwiz-label-title' )
                              .append( mw.message( 'mwe-upwiz-source-thirdparty-compliance-label', this.uploadCount, mw.user ).parseDom() )
          Severity: Major
          Found in resources/deed/uw.deed.ThirdParty.js and 2 other locations - About 2 hrs to fix
          resources/deed/uw.deed.OwnWork.js on lines 268..281
          resources/deed/uw.deed.OwnWork.js on lines 289..296

          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.authorInputField = new uw.FieldLayout( this.authorInput, {
                      label: $( '<li>' )
                          .addClass( 'mwe-upwiz-label-title' )
                          .msg( 'mwe-upwiz-author-text', this.uploadCount, mw.user ),
                      required: true
          Severity: Major
          Found in resources/deed/uw.deed.ThirdParty.js and 1 other location - About 1 hr to fix
          resources/deed/uw.deed.ThirdParty.js on lines 69..74

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

          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.sourceInputField = new uw.FieldLayout( this.sourceInput, {
                      label: $( '<li>' )
                          .addClass( 'mwe-upwiz-label-title' )
                          .msg( 'mwe-upwiz-source-text', this.uploadCount, mw.user ),
                      required: true
          Severity: Major
          Found in resources/deed/uw.deed.ThirdParty.js and 1 other location - About 1 hr to fix
          resources/deed/uw.deed.ThirdParty.js on lines 113..118

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

          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.sourceInput.$element.after(
                          $( '<div>' ).addClass( 'mwe-upwiz-thirdparty-checkbox' )
                              .append( this.templateOptions.aiGenerated.field.$element )
                      );
          Severity: Minor
          Found in resources/deed/uw.deed.ThirdParty.js and 1 other location - About 55 mins to fix
          resources/deed/uw.deed.ThirdParty.js on lines 265..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 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

                          this.authorInput.$element.after(
                              $( '<div>' ).addClass( 'mwe-upwiz-thirdparty-checkbox' )
                                  .append( this.templateOptions.authorUnknown.field.$element )
                          );
          Severity: Minor
          Found in resources/deed/uw.deed.ThirdParty.js and 1 other location - About 55 mins to fix
          resources/deed/uw.deed.ThirdParty.js on lines 238..241

          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

                      var
                          errors = [],
                          minLength = deed.config.minSourceLength,
                          maxLength = deed.config.maxSourceLength,
                          text = this.getValue().trim();
          Severity: Minor
          Found in resources/deed/uw.deed.ThirdParty.js and 1 other location - About 55 mins to fix
          resources/deed/uw.deed.ThirdParty.js on lines 83..87

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

          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

                      var
                          errors = [],
                          minLength = deed.config.minAuthorLength,
                          maxLength = deed.config.maxAuthorLength,
                          text = this.getValue().trim();
          Severity: Minor
          Found in resources/deed/uw.deed.ThirdParty.js and 1 other location - About 55 mins to fix
          resources/deed/uw.deed.ThirdParty.js on lines 43..47

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

          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.CheckboxMultioptionWidget( {
                              label: mw.message( 'mwe-upwiz-source-thirdparty-compliance-option-copyright', this.uploadCount, mw.user ).text(),
                              data: 'copyright'
                          } )
          Severity: Major
          Found in resources/deed/uw.deed.ThirdParty.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.OwnWork.js on lines 300..303

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

                  this.sourceInput.getWarnings = function () {
                      return $.Deferred().resolve( [] ).promise();
                  };
          Severity: Minor
          Found in resources/deed/uw.deed.ThirdParty.js and 1 other location - About 40 mins to fix
          resources/deed/uw.deed.ThirdParty.js on lines 110..112

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

          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.authorInput.getWarnings = function () {
                      return $.Deferred().resolve( [] ).promise();
                  };
          Severity: Minor
          Found in resources/deed/uw.deed.ThirdParty.js and 1 other location - About 40 mins to fix
          resources/deed/uw.deed.ThirdParty.js on lines 66..68

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

          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