wikimedia/mediawiki-core

View on GitHub
resources/src/mediawiki.special.upload/upload.js

Summary

Maintainability
D
1 day
Test Coverage

File upload.js has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * JavaScript for Special:Upload
 *
 * @private
 * @class mw.special.upload
Severity: Minor
Found in resources/src/mediawiki.special.upload/upload.js - About 5 hrs to fix

    Function showPreview has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function showPreview( file ) {
                var $canvas,
                    ctx,
                    meta,
                    previewSize = 180,
    Severity: Major
    Found in resources/src/mediawiki.special.upload/upload.js - About 3 hrs to fix

      Function onload has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      img.onload = function () {
                          var info, width, height, x, y, dx, dy, logicalWidth, logicalHeight;
      
                          // Fit the image within the previewSizexpreviewSize box
                          if ( img.width > img.height ) {
      Severity: Minor
      Found in resources/src/mediawiki.special.upload/upload.js - About 1 hr to fix

        Function checkNow has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                checkNow: function ( nameToCheck ) {
                    var $spinnerDestCheck, title, requestTitle;
                    if ( nameToCheck.trim() === '' ) {
                        return;
                    }
        Severity: Minor
        Found in resources/src/mediawiki.special.upload/upload.js - About 1 hr to fix

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

                  function fetchPreview( file, callback, callbackBinary ) {
                      var reader = new FileReader();
                      if ( callbackBinary && 'readAsBinaryString' in reader ) {
                          // To fetch JPEG metadata we need a binary string; start there.
                          // TODO
          Severity: Minor
          Found in resources/src/mediawiki.special.upload/upload.js - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status