wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 260 of 260 total issues

Function getConfigFromDB has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function getConfigFromDB( $id ) {
        $config = [];

        $confProps = $this->dbr->newSelectQueryBuilder()
            ->select( [ 'cc_property', 'cc_value' ] )
Severity: Minor
Found in maintenance/migrateCampaigns.php - About 55 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

            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

Method onArticleDeleteComplete has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $article, $user, $reason, $id, $content, $logEntry, $archivedRevisionCount
Severity: Major
Found in includes/CampaignHooks.php - About 50 mins to fix

    Method onPageMoveComplete has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $oldTitle,
            $newTitle,
            $user,
            $pageid,
            $redirid,
    Severity: Major
    Found in includes/CampaignHooks.php - About 50 mins to fix

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

              if ( doOwnWork ) {
                  deed = new uw.deed.OwnWork( this.config, uploads, this.api );
                  deeds[ deed.name ] = deed;
              }
      Severity: Minor
      Found in resources/controller/uw.controller.Deed.js and 1 other location - About 50 mins to fix
      resources/controller/uw.controller.Deed.js on lines 277..280

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

              } else if ( this.type === 'checkbox' ) {
                  this.group = this.createCheckboxGroup( [ 'mwe-upwiz-deed-license-group-body' ] );
                  this.group.connect( this, { select: [ 'emit', 'change', this ] } );
              }
      Severity: Minor
      Found in resources/uw.LicenseGroup.js and 1 other location - About 50 mins to fix
      resources/uw.LicenseGroup.js on lines 45..51

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

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

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

              if ( this.type === 'radio' ) {
                  this.group = this.createRadioGroup( [ 'mwe-upwiz-deed-license-group-body' ] );
                  this.group.connect( this, { choose: [ 'emit', 'change', this ] } );
              } else if ( this.type === 'checkbox' ) {
                  this.group = this.createCheckboxGroup( [ 'mwe-upwiz-deed-license-group-body' ] );
      Severity: Minor
      Found in resources/uw.LicenseGroup.js and 1 other location - About 50 mins to fix
      resources/uw.LicenseGroup.js on lines 48..51

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

              if ( doThirdParty ) {
                  deed = new uw.deed.ThirdParty( this.config, uploads, this.api );
                  deeds[ deed.name ] = deed;
              }
      Severity: Minor
      Found in resources/controller/uw.controller.Deed.js and 1 other location - About 50 mins to fix
      resources/controller/uw.controller.Deed.js on lines 273..276

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

      Method onEditFilterMergedContent has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function onEditFilterMergedContent( IContextSource $context, Content $content, Status $status, $summary,
              User $user, $minoredit
      Severity: Minor
      Found in includes/CampaignHooks.php - About 45 mins to fix

        Function maybeRetry has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            mw.FormDataTransport.prototype.maybeRetry = function ( contextMsg, code, response, retryMethod, file, offset ) {
        Severity: Minor
        Found in resources/transports/mw.FormDataTransport.js - About 45 mins to fix

          Function GroupProgressBar has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              mw.GroupProgressBar = function ( selector, uploads, successStates, errorStates, progressProperty, weightProperty ) {
          Severity: Minor
          Found in resources/mw.GroupProgressBar.js - About 45 mins to fix

            Method onPageSaveComplete has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    $wikiPage,
                    $userIdentity,
                    $summary,
                    $flags,
                    $revisionRecord,
            Severity: Minor
            Found in includes/CampaignHooks.php - About 45 mins to fix

              Function applyObjectReferenceToButtons has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function applyObjectReferenceToButtons( $objRef ) {
                      $customizableButtons = [ 'homeButton', 'beginButton' ];
              
                      foreach ( $customizableButtons as $button ) {
                          if ( isset( $this->parsedConfig['display'][$button]['target'] ) &&
              Severity: Minor
              Found in includes/Campaign.php - 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 getImageHtml has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getImageHtml( MediaTransformOutput $thumb, $tutorial ) {
                      $helpDeskUrl = wfMessage( 'mwe-upwiz-help-desk-url' )->text();
              
                      // Per convention, we may be either using an absolute URL or a wiki page title in this UI message
                      if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $helpDeskUrl ) ) {
              Severity: Minor
              Found in includes/Tutorial.php - 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

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

                          if ( mw.UploadWizard.config.defaults.lon ) {
                              values.longitude = mw.UploadWizard.config.defaults.lon;
                          }
              Severity: Major
              Found in resources/mw.UploadWizardDetails.js and 2 other locations - About 45 mins to fix
              resources/mw.UploadWizardDetails.js on lines 765..767
              resources/mw.UploadWizardDetails.js on lines 771..773

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

              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

                          if ( mw.UploadWizard.config.trackingCategory.all ) {
                              hiddenCats.push( mw.UploadWizard.config.trackingCategory.all );
                          }
              Severity: Minor
              Found in resources/details/uw.CategoriesDetailsWidget.js and 1 other location - About 45 mins to fix
              resources/details/uw.CategoriesDetailsWidget.js on lines 78..80

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

              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

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

                      this.queue = new uw.ConcurrentQueue( {
                          count: this.config.maxSimultaneousConnections,
                          action: this.transitionOne.bind( this )
                      } );
              Severity: Minor
              Found in resources/controller/uw.controller.Details.js and 1 other location - About 45 mins to fix
              resources/controller/uw.controller.Upload.js on lines 44..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 50.

              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