Jforrester has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/247739

Change subject: Enable jscs-jsdoc's remaining rules and make pass
......................................................................

Enable jscs-jsdoc's remaining rules and make pass

Change-Id: I991431bacd857317ba64fd4a841f8d586f491b70
---
M .jscsrc
M resources/controller/uw.controller.Step.js
M resources/mw.FlickrChecker.js
M resources/mw.UploadWizard.js
M resources/mw.UploadWizardDeed.js
M resources/mw.UploadWizardDetails.js
M resources/mw.UploadWizardLicenseInput.js
M resources/mw.UploadWizardUpload.js
M resources/mw.UploadWizardUploadInterface.js
M resources/mw.units.js
M resources/ui/uw.ui.Thanks.js
M resources/ui/uw.ui.Upload.js
M resources/uw.EventFlowLogger.js
13 files changed, 70 insertions(+), 68 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/39/247739/1

diff --git a/.jscsrc b/.jscsrc
index e7be582..7ca08f2 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -8,6 +8,9 @@
                                "see": true
                        }
                },
+               "checkParamNames": true,
+               "checkRedundantAccess": true,
+               "checkRedundantReturns": true,
                "requireNewlineAfterDescription": true,
                "requireParamTypes": true,
                "requireReturnTypes": true
diff --git a/resources/controller/uw.controller.Step.js 
b/resources/controller/uw.controller.Step.js
index 4414ef0..10084e4 100644
--- a/resources/controller/uw.controller.Step.js
+++ b/resources/controller/uw.controller.Step.js
@@ -215,7 +215,6 @@
        /**
         * Check if upload is able to be put through this step's changes.
         *
-        * @param {mw.UploadWizardUpload}
         * @return {boolean}
         */
        uw.controller.Step.prototype.canTransition = function () {
diff --git a/resources/mw.FlickrChecker.js b/resources/mw.FlickrChecker.js
index 8b12a8f..0bf46f8 100644
--- a/resources/mw.FlickrChecker.js
+++ b/resources/mw.FlickrChecker.js
@@ -61,9 +61,7 @@
                 * changes the name associated with a license ID, it's better 
for the lookup to fail than to use
                 * an incorrect license.
                 *
-                * @param {string} url The source URL to check
-                * @param {string} $selector The element to insert the license 
name into
-                * @param {UploadWizardUpload} upload The upload object to set 
the deed for
+                * @param {string} flickrInputUrl The source URL to check
                 */
                checkFlickr: function ( flickrInputUrl ) {
                        var photoIdMatches, albumIdMatches, 
userCollectionMatches, userPhotostreamMatches, groupPoolMatches, 
userGalleryMatches, userFavoritesMatches;
@@ -183,7 +181,7 @@
                /**
                 * Retrieves a list of photos in group pool and displays it.
                 *
-                * @param {object} groupPoolMatches Result of `this.url.match`
+                * @param {Object} groupPoolMatches Result of `this.url.match`
                 * @see {@link getPhotos}
                 */
                getGroupPool: function ( groupPoolMatches ) {
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index c67ab99..2d3992d 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -394,7 +394,7 @@
                 * This is useful to clean out file inputs that we don't want 
for some reason (error, empty...)
                 * We are using a second array to iterate, because we will be 
splicing the main one, _this.uploads
                 *
-                * @param {function} criterion Function to test the upload, 
returns boolean; true if should be removed
+                * @param {Function} criterion Function to test the upload, 
returns boolean; true if should be removed
                 */
                removeMatchingUploads: function ( criterion ) {
                        var toRemove = [];
@@ -507,7 +507,7 @@
         * TODO v1.1 split into two plugins?
         *
         * @param {string} key Will base the tooltip on a message found with 
this key
-        * @param {function} [fn] Call this function every time tip is created 
to generate message. If present, HTML element gets an id of the exact key 
specified
+        * @param {Function} [fn] Call this function every time tip is created 
to generate message. If present, HTML element gets an id of the exact key 
specified
         */
        $.fn.addHint = function ( key, fn ) {
                var attrs, contentSource, html = false;
diff --git a/resources/mw.UploadWizardDeed.js b/resources/mw.UploadWizardDeed.js
index ffeb646..74c8562 100644
--- a/resources/mw.UploadWizardDeed.js
+++ b/resources/mw.UploadWizardDeed.js
@@ -70,8 +70,8 @@
        /**
         * Set up the form and deed object for the deed option that says these 
uploads are all the user's own work.
         *
-        * @param {number} integer count of uploads that this deed refers to 
(useful for message pluralization)
-        * @param {mw.Api} api object - useful for doing previews
+        * @param {number} uploadCount Integer count of uploads that this deed 
refers to (useful for message pluralization)
+        * @param {mw.Api} api API object - useful for doing previews
         * @param {Object} config The UW config
         */
        mw.UploadWizardDeedOwnWork = function ( uploadCount, api, config ) {
@@ -311,8 +311,8 @@
        /**
         * Set up the form and deed object for the deed option that says these 
uploads are the work of a third party.
         *
-        * @param {number} integer count of uploads that this deed refers to 
(useful for message pluralization)
-        * @param {mw.Api} api object - useful for doing previews
+        * @param {number} uploadCount Integer count of uploads that this deed 
refers to (useful for message pluralization)
+        * @param {mw.Api} api API object - useful for doing previews
         * @param {Object} config The UW config
         */
        mw.UploadWizardDeedThirdParty = function ( uploadCount, api, config ) {
@@ -447,8 +447,8 @@
         *
         * @param {Object} config The UW config
         * @param {string|jQuery} selector where to put this deed chooser
-        * @param {Array[UploadWizardDeed]} deeds
-        * @param {Array[UploadWizardUpload]} uploads that this applies to 
(this is just to make deleting and plurals work)
+        * @param {UploadWizardDeed[]} deeds
+        * @param {UploadWizardUpload[]} uploads that this applies to (this is 
just to make deleting and plurals work)
         */
        mw.UploadWizardDeedChooser = function ( config, selector, deeds, 
uploads ) {
                var chooser = this;
diff --git a/resources/mw.UploadWizardDetails.js 
b/resources/mw.UploadWizardDetails.js
index 96e6ada..22927d2 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -1740,8 +1740,8 @@
                /**
                 * Show error state, possibly using a recoverable error form
                 *
-                * @param {string} error code
-                * @param {string} status line
+                * @param {string} code Error code
+                * @param {string} statusLine Status line
                 */
                showError: function ( code, statusLine ) {
                        uw.eventFlowLogger.logError( 'details', { code: code, 
message: statusLine } );
@@ -1752,8 +1752,8 @@
                /**
                 * Decide how to treat various errors
                 *
-                * @param {string} error code
-                * @param {Mixed} result from ajax call
+                * @param {string} code Error code
+                * @param {Mixed} result Result from ajax call
                 */
                processError: function ( code, result ) {
                        var statusKey, comma,
@@ -1862,7 +1862,7 @@
                 * Apply some special cleanups for titles before adding to 
model. These cleanups are not reflected in what the user sees in the title 
input field.
                 * For example, we remove an extension in the title if it 
matches the extension we're going to add anyway. (bug #30676)
                 *
-                * @param {string} title in human-readable form, e.g. "Foo 
bar", rather than "File:Foo_bar.jpg"
+                * @param {string} s Title in human-readable form, e.g. "Foo 
bar", rather than "File:Foo_bar.jpg"
                 * @return {mw.Title} cleaned title with prefix and extension, 
stringified.
                 */
                setCleanTitle: function ( s ) {
diff --git a/resources/mw.UploadWizardLicenseInput.js 
b/resources/mw.UploadWizardLicenseInput.js
index 581c6a3..9a07435 100644
--- a/resources/mw.UploadWizardLicenseInput.js
+++ b/resources/mw.UploadWizardLicenseInput.js
@@ -164,15 +164,16 @@
                 *
                 * Abstracts out simple lists of licenses, more complex groups 
with layout
                 *
-                * @param {jQuery} selector to add inputs to
-                * @param {Array} license configuration, which must have a 
'licenses' property, which is an array of license names
-                *                      it may also have: 'prependTemplates' or 
'template', which alter the final wikitext value
-                *                      'prependTemplates' will prepend 
Templates. If prependTemplates were [ 'pre', 'pended' ], then...
-                *                              [ 'fooLicense' ] -> 
"{{pre}}{{pended}}{{fooLicense}}"
-                *                      'template' will filter Templates, as in 
"own work". If 'filterTemplate' was 'filter', then...
-                *                              [ 'fooLicense', 'barLicense' ] 
-> {{filter|fooLicense|barLicense}}
-                * @param {jQuery} optional - jquery-wrapped element created by 
$.fn.collapseToggle(), which has 'close' and 'open'
-                *                      methods in its data.
+                * @param {jQuery} $el Selector to which to add inputs
+                * @param {Array} config License configuration, which must have 
a 'licenses' property, which is
+                *   an array of license names. It may also have:
+                *  * 'prependTemplates' or 'template', which alter the final 
wikitext value
+                *      * 'prependTemplates' will prepend Templates. If 
prependTemplates were [ 'pre', 'pended' ],
+                *    then [ 'fooLicense' ] -> "{{pre}}{{pended}}{{fooLicense}}"
+                *  * 'template' will filter Templates, as in "own work". If 
'filterTemplate' was 'filter',
+                *    then  [ 'fooLicense', 'barLicense' ] -> 
{{filter|fooLicense|barLicense}}
+                * @param {jQuery} [$groupToggler] A jquery-wrapped element 
created by $.fn.collapseToggle(),
+                *   which has 'close' and 'open' methods in its data.
                 *
                 */
                createInputs: function ( $el, config, $groupToggler ) {
@@ -220,8 +221,8 @@
                 * However, configuration for a particular option can add other 
templates or transform the templates,
                 * such as wrapping templates in an outer "self" template for 
own-work
                 *
-                * @param {Array} of license template names
-                * @param {Object}, license input configuration
+                * @param {Array} templates Array of license template names
+                * @param {Object} config License input configuration
                 * @return {string} of wikitext
                 */
                createInputValueFromTemplateConfig: function ( templates, 
config ) {
@@ -242,7 +243,7 @@
                /**
                 * Return a radio button or checkbox with appropriate values, 
depending on config
                 *
-                * @param {Array} of template strings
+                * @param {Array} templates Array of template strings
                 * @param {Object} config for this license input
                 * @return {jQuery} wrapped input
                 */
@@ -272,12 +273,15 @@
                /**
                 * Get a label for the form element
                 *
-                * @param {Object} license definition from global config. Will 
tell us the messages, and maybe icons.
-                * @param {jQuery} wrapped input
+                * @param {Object} license License definition from global 
config. Will tell us the messages, and
+                *   maybe icons.
+                * @param {jQuery} $input Wrapped input
                 * @return {jQuery} wrapped label referring to that input, with 
appropriate HTML, decorations, etc.
                 */
                createInputElementLabel: function ( license, $input ) {
-                       var messageKey = license.props.msg === undefined ? 
'[missing msg for ' + license.name + ']' : license.props.msg,
+                       var messageKey = license.props.msg === undefined ?
+                                       '[missing msg for ' + license.name + 
']' :
+                                       license.props.msg,
                                languageCode = mw.config.get( 'wgUserLanguage' 
),
 
                                // The URL is optional, but if the message 
includes it as $2, we surface the fact
@@ -306,7 +310,7 @@
                 * Given an input, return another textarea to be appended below.
                 * When text entered here, auto-selects the input.
                 *
-                * @param {jQuery} wrapped input
+                * @param {jQuery} $input Wrapped input
                 * @return {jQuery} wrapped textarea
                 */
                createCustomWikiTextInterface: function ( $input ) {
@@ -378,7 +382,7 @@
                 * Sets the value(s) of a license input. This is a little bit 
klugey because it relies on an inverted dict, and in some
                 * cases we are now letting license inputs create multiple 
templates.
                 *
-                * @param {object} values License-key to boolean values, e.g. { 
'cc_by_sa_30': true, gfdl: true, 'flickrreview|cc_by_sa_30': false }
+                * @param {Object} values License-key to boolean values, e.g. { 
'cc_by_sa_30': true, gfdl: true, 'flickrreview|cc_by_sa_30': false }
                 */
                setValues: function ( values ) {
                        var trueCount, trueLicenseName,
@@ -472,7 +476,7 @@
                /**
                 * Gets which inputs have user-entered values
                 *
-                * @return {jQuery Array} of inputs
+                * @return {jQuery} Array of inputs
                 */
                getSelectedInputs: function () {
                        // not sure why filter(':checked') doesn't work
@@ -553,7 +557,7 @@
                /**
                 * Preview wikitext in a popup window
                 *
-                * @param {string} wikitext
+                * @param {string} wikiText
                 */
                showPreview: function ( wikiText ) {
                        var input;
diff --git a/resources/mw.UploadWizardUpload.js 
b/resources/mw.UploadWizardUpload.js
index 711b55b..3f4e28d 100644
--- a/resources/mw.UploadWizardUpload.js
+++ b/resources/mw.UploadWizardUpload.js
@@ -273,7 +273,6 @@
         *
         * @param {string} code Error code, should have matching strings in 
.i18n.php
         * @param {Object} resultDuplicate Portion of the API error result 
listing duplicates
-        * @return {jQuery}
         */
        mw.UploadWizardUpload.prototype.setDuplicateError = function ( code, 
resultDuplicate ) {
                var duplicates, $ul, $override, $extra;
@@ -384,9 +383,9 @@
         * case where an error should be ignored, you can simply find that error
         * and delete it from the third parameter of the error callback. The 
end.
         *
-        * @param {string} the filename
-        * @param {Array} of Files.  usually one, can be more for multi-file 
select.
-        * @param {function ()} callback when ok, and upload object is ready
+        * @param {string} filename The filename
+        * @param {Array} files Array of files, usually one; can be more for 
multi-file select.
+        * @param {Function} fileNameOk Callback to use when ok, and upload 
object is ready
         */
        mw.UploadWizardUpload.prototype.checkFile = function ( filename, files, 
fileNameOk ) {
                var totalSize, duplicate, extension, toobig,
@@ -597,7 +596,7 @@
        /**
         * Map fields from jpegmeta's metadata return into our format (which is 
more like the imageinfo returned from the API
         *
-        * @param {Object} (as returned by jpegmeta)
+        * @param {Object} meta As returned by jpegmeta
         */
        mw.UploadWizardUpload.prototype.extractMetadataFromJpegMeta = function 
( meta ) {
                var pixelHeightDim, pixelWidthDim, degrees;
@@ -636,7 +635,7 @@
        /**
         * Accept the result from a successful API upload transport, and fill 
our own info
         *
-        * @param {Object} result The JSON object from a successful API upload 
result.
+        * @param {Object} resultUpload The JSON object from a successful API 
upload result.
         */
        mw.UploadWizardUpload.prototype.extractUploadInfo = function ( 
resultUpload ) {
                if ( resultUpload.filekey ) {
@@ -688,10 +687,10 @@
         *
         * See API documentation for prop=stashimageinfo for what 'props' can 
contain
         *
-        * @param {Function} callback -- called with null if failure, with 
imageinfo data structure if success
-        * @param {Array} properties to extract
-        * @param {number} optional, width of thumbnail. Will force 'url' to be 
added to props
-        * @param {number} optional, height of thumbnail. Will force 'url' to 
be added to props
+        * @param {Function} callback Called with null if failure, with 
imageinfo data structure if success
+        * @param {Array} props Properties to extract
+        * @param {number} [width] Width of thumbnail. Will force 'url' to be 
added to props
+        * @param {number} [height] Height of thumbnail. Will force 'url' to be 
added to props
         */
        mw.UploadWizardUpload.prototype.getStashImageInfo = function ( 
callback, props, width, height ) {
                var params = {
@@ -738,10 +737,10 @@
         * (There is some overlap with getStashedImageInfo, but it's different 
at every stage so it's clearer to have separate functions)
         * See API documentation for prop=imageinfo for what 'props' can contain
         *
-        * @param {Function} callback -- called with null if failure, with 
imageinfo data structure if success
-        * @param {Array} properties to extract
-        * @param {number} optional, width of thumbnail. Will force 'url' to be 
added to props
-        * @param {number} optional, height of thumbnail. Will force 'url' to 
be added to props
+        * @param {Function} callback Called with null if failure, with 
imageinfo data structure if success
+        * @param {Array} props Properties to extract
+        * @param {number} [width] Width of thumbnail. Will force 'url' to be 
added to props
+        * @param {number} [height] Height of thumbnail. Will force 'url' to be 
added to props
         */
        mw.UploadWizardUpload.prototype.getImageInfo = function ( callback, 
props, width, height ) {
                var requestedTitle, params;
@@ -944,8 +943,8 @@
        /**
         * Fit an image into width & height constraints with scaling factor
         *
-        * @param {HTMLImageElement}
-        * @param {Object} with width & height properties
+        * @param {HTMLImageElement} image
+        * @param {Object} constraints Width & height properties
         * @return {number}
         */
        mw.UploadWizardUpload.prototype.getScalingFromConstraints = function ( 
image, constraints ) {
@@ -966,8 +965,8 @@
         * Given an image (already loaded), dimension constraints
         * return canvas object scaled & transformedi ( & rotated if metadata 
indicates it's needed )
         *
-        * @param {HTMLImageElement}
-        * @param {Object} containing width & height constraints
+        * @param {HTMLImageElement} image
+        * @param {Object} constraints Width & height constraints
         * @return {HTMLCanvasElement}
         */
        mw.UploadWizardUpload.prototype.getTransformedCanvasElement = function 
( image, constraints ) {
@@ -1039,8 +1038,8 @@
        /**
         * Return a browser-scaled image element, given an image and 
constraints.
         *
-        * @param {HTMLImageElement}
-        * @param {Object} with width and height properties
+        * @param {HTMLImageElement} image
+        * @param {Object} constraints Width and height properties
         * @return {HTMLImageElement} with same src, but different attrs
         */
        mw.UploadWizardUpload.prototype.getBrowserScaledImageElement = function 
( image, constraints ) {
@@ -1059,7 +1058,7 @@
        /**
         * Return an element suitable for the preview of a certain size. Uses 
canvas when possible
         *
-        * @param {HTMLImageElement}
+        * @param {HTMLImageElement} image
         * @param {Integer} width
         * @param {Integer} height
         * @return {HTMLCanvasElement|HTMLImageElement}
@@ -1093,7 +1092,7 @@
                /**
                 * This callback will add an image to the selector, using 
in-browser scaling if necessary
                 *
-                * @param {HTMLImageElement|null}
+                * @param {HTMLImageElement|null} image
                 */
                function placeImageCallback( image ) {
                        var elm;
diff --git a/resources/mw.UploadWizardUploadInterface.js 
b/resources/mw.UploadWizardUploadInterface.js
index 4b1d7a7..d595cde 100644
--- a/resources/mw.UploadWizardUploadInterface.js
+++ b/resources/mw.UploadWizardUploadInterface.js
@@ -6,7 +6,7 @@
         * @class mw.UploadWizardUploadInterface
         * @mixins OO.EventEmitter
         * @constructor
-        * @param {object} upload …
+        * @param {Object} upload …
         * @param {jQuery} filesDiv DIV into which to insert file interface
         */
        mw.UploadWizardUploadInterface = function 
MWUploadWizardUploadInterface( upload, filesDiv ) {
@@ -184,7 +184,7 @@
         * Set the status line for this upload with an internationalized 
message string.
         *
         * @param {string} msgKey Key for the message
-        * @param {array} args Array of values, in case any need to be fed to 
the image.
+        * @param {Array} args Array of values, in case any need to be fed to 
the image.
         */
        mw.UploadWizardUploadInterface.prototype.setStatus = function ( msgKey, 
args ) {
                var $s;
@@ -199,7 +199,7 @@
        /**
         * Set status line directly with a string
         *
-        * @param {string}
+        * @param {string} s
         */
        mw.UploadWizardUploadInterface.prototype.setStatusString = function ( s 
) {
                $( this.div ).find( '.mwe-upwiz-file-status' ).html( s ).show();
diff --git a/resources/mw.units.js b/resources/mw.units.js
index 0b86e16..ff93174 100644
--- a/resources/mw.units.js
+++ b/resources/mw.units.js
@@ -3,14 +3,13 @@
        var scaleMsgKeys = [ 'size-bytes', 'size-kilobytes', 'size-megabytes', 
'size-gigabytes' ];
 
        mw.units = {
-
                /**
                 * Format a size in bytes for output, using an appropriate
                 * unit (bytes, K, MB, GB, or TB) according to the magnitude in 
question
                 *
                 * Units above K get 2 fixed decimal places.
                 *
-                * @param {number} size, positive integer
+                * @param {number} size Number of bytes
                 * @return {string} formatted size
                 */
                bytes: function ( size ) {
diff --git a/resources/ui/uw.ui.Thanks.js b/resources/ui/uw.ui.Thanks.js
index 011ff27..d164a72 100644
--- a/resources/ui/uw.ui.Thanks.js
+++ b/resources/ui/uw.ui.Thanks.js
@@ -157,7 +157,7 @@
        /**
         * Make a read only text input, which self-selects on gaining focus
         *
-        * @param {string} text it will contain
+        * @param {string} s Text it will contain
         * @return {jQuery}
         */
        uw.ui.Thanks.prototype.makeReadOnlyInput = function ( s ) {
diff --git a/resources/ui/uw.ui.Upload.js b/resources/ui/uw.ui.Upload.js
index 8837501..7508e44 100644
--- a/resources/ui/uw.ui.Upload.js
+++ b/resources/ui/uw.ui.Upload.js
@@ -302,7 +302,7 @@
        /**
         * Checks whether flickr import is enabled and the current user has the 
rights to use it
         *
-        * @return {Boolean}
+        * @return {boolean}
         */
        uw.ui.Upload.prototype.isFlickrImportEnabled = function () {
                return mw.UploadWizard.config.UploadFromUrl && 
mw.UploadWizard.config.flickrApiKey !== '';
diff --git a/resources/uw.EventFlowLogger.js b/resources/uw.EventFlowLogger.js
index fbcddec..f856c17 100644
--- a/resources/uw.EventFlowLogger.js
+++ b/resources/uw.EventFlowLogger.js
@@ -84,7 +84,7 @@
         *
         * @protected
         * @param {string} schema EventLogger schema name
-        * @param {object} data event data (without flowId)
+        * @param {Object} data event data (without flowId)
         */
        uw.EventFlowLogger.prototype.log = function ( schema, data ) {
                if ( !this.eventLog ) {
@@ -146,7 +146,7 @@
         *  - upload-failed
         *  - upload-removed
         *  - uploads-added
-        * @param {object} data
+        * @param {Object} data
         * @param {string} data.extension file extension
         * @param {number} data.quantity number of files added
         * @param {number} data.size file size in bytes (will be anonymized)

-- 
To view, visit https://gerrit.wikimedia.org/r/247739
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I991431bacd857317ba64fd4a841f8d586f491b70
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to