wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 272 of 272 total issues

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

            ui.$buttons.append(
                $( '<div>' )
                    .addClass( 'mwe-upwiz-file-next-all-ok mwe-upwiz-file-endchoice' )
                    .append(
                        new OO.ui.HorizontalLayout( {
Severity: Major
Found in resources/ui/steps/uw.ui.Upload.js and 2 other locations - About 3 hrs to fix
resources/ui/steps/uw.ui.Details.js on lines 140..153
resources/ui/steps/uw.ui.Upload.js on lines 379..392

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

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

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

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

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

Refactorings

Further Reading

Function load has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    uw.controller.Deed.prototype.load = function ( uploads ) {
        var self = this,
            // select "provide same information for all files" by default
            defaultDeedInterface = 'common',
            localUploads = uploads.filter( ( upload ) => {
Severity: Major
Found in resources/controller/uw.controller.Deed.js - About 3 hrs to fix

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

            if ( width !== undefined || height !== undefined ) {
                if ( props.indexOf( 'url' ) === -1 ) {
                    props.push( 'url' );
                }
                if ( width !== undefined ) {
    Severity: Major
    Found in resources/mw.UploadWizardUpload.js and 1 other location - About 3 hrs to fix
    resources/mw.UploadWizardUpload.js on lines 439..449

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

    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 ( width !== undefined || height !== undefined ) {
                if ( props.indexOf( 'url' ) === -1 ) {
                    props.push( 'url' );
                }
                if ( width !== undefined ) {
    Severity: Major
    Found in resources/mw.UploadWizardUpload.js and 1 other location - About 3 hrs to fix
    resources/mw.UploadWizardUpload.js on lines 373..383

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

    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

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

          uw.ui.Thanks = function UWUIThanks( config ) {
              var homeButtonTarget,
                  homeButtonHref,
                  homeButtonUrl,
                  thanksMessage,
      Severity: Major
      Found in resources/ui/steps/uw.ui.Thanks.js - About 2 hrs to fix

        Method addJsVars has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function addJsVars( $subPage ) {
                $config = Config::getConfig( $this->campaign );
        
                if ( array_key_exists( 'trackingCategory', $config ) ) {
                    if ( array_key_exists( 'campaign', $config['trackingCategory'] ) ) {
        Severity: Major
        Found in includes/Specials/SpecialUploadWizard.php - About 2 hrs to fix

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

          Function getPhoto has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getPhoto: function ( photoIdMatches ) {
                  var checker = this;
                  var photoId = photoIdMatches[ 1 ];
          
                  return this.flickrRequest( {
          Severity: Major
          Found in resources/mw.FlickrChecker.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

              File uw.LicenseGroup.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              ( function ( uw ) {
              
                  /**
                   * @extends OO.ui.LicenseGroup
                   *
              Severity: Minor
              Found in resources/uw.LicenseGroup.js - About 2 hrs to fix

                Method getParsedConfig has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getParsedConfig( Language $lang = null ) {
                        if ( $lang === null ) {
                            $lang = $this->context->getLanguage();
                        }
                
                
                Severity: Major
                Found in includes/Campaign.php - About 2 hrs to fix

                  Function UWMetadataContent has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      uw.MetadataContent = function UWMetadataContent( upload, config ) {
                          var $titleDiv,
                              $filenameDiv,
                              $thumbnailDiv,
                              self = this;
                  Severity: Major
                  Found in resources/metadata/uw.MetadataContent.js - About 2 hrs to fix

                    Function uploadChunk has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        mw.FormDataTransport.prototype.uploadChunk = function ( file, offset ) {
                            var params = this.createParams( this.tempname, offset ),
                                transport = this,
                                bytesAvailable = file.size,
                                chunk;
                    Severity: Major
                    Found in resources/transports/mw.FormDataTransport.js - About 2 hrs to fix

                      Function prefillDate has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              prefillDate: function () {
                                  var dateObj, metadata, dateTimeRegex, matches, dateStr, saneTime,
                                      dateMode = 'calendar',
                                      yyyyMmDdRegex = /^(\d\d\d\d)[:/-](\d\d)[:/-](\d\d)\D.*/,
                                      timeRegex = /\D(\d\d):(\d\d):(\d\d)/;
                      Severity: Major
                      Found in resources/mw.UploadWizardDetails.js - About 2 hrs to fix

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

                                this.retryButtonAllFailed = new OO.ui.ButtonWidget( {
                                    label: mw.message( 'mwe-upwiz-file-retry' ).text(),
                                    flags: [ 'progressive' ]
                                } ).on( 'click', () => {
                                    upload.hideEndButtons();
                        Severity: Major
                        Found in resources/ui/steps/uw.ui.Upload.js and 1 other location - About 2 hrs to fix
                        resources/ui/steps/uw.ui.Upload.js on lines 158..164

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

                        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.retryButtonSomeFailed = new OO.ui.ButtonWidget( {
                                    label: mw.message( 'mwe-upwiz-file-retry' ).text(),
                                    flags: [ 'progressive' ]
                                } ).on( 'click', () => {
                                    upload.hideEndButtons();
                        Severity: Major
                        Found in resources/ui/steps/uw.ui.Upload.js and 1 other location - About 2 hrs to fix
                        resources/ui/steps/uw.ui.Upload.js on lines 173..179

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

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

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

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

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

                        Refactorings

                        Further Reading

                        Function submit has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                submit: function () {
                                    var details = this,
                                        wikitext, captions, promise, languageCodes, allLanguages, errorString;
                        
                                    this.$containerDiv.find( 'form' ).trigger( 'submit' );
                        Severity: Major
                        Found in resources/mw.UploadWizardDetails.js - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language