[MediaWiki-commits] [Gerrit] mediawiki...ImageMetrics[master]: build: bump grunt-jscs to 2.1.0

2017-08-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/369341 )

Change subject: build: bump grunt-jscs to 2.1.0
..


build: bump grunt-jscs to 2.1.0

Avoids a peer dependency incompatibility with grunt
Update file comments /** -> /*! per T119193
Add new lines in comments

Ignore a jscs-jsdoc issue with return values since it does not detect
class inheritance:
https://github.com/jscs-dev/jscs-jsdoc/issues/31

Change-Id: If81ad41eaf4b3ea9405f15b8a2d20c4b83ba5a56
---
M package.json
M resources/head.js
M resources/loader.js
M resources/logger/LoadingTimeLogger.js
M resources/logger/Logger.js
5 files changed, 23 insertions(+), 7 deletions(-)

Approvals:
  Umherirrender: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/package.json b/package.json
index 5e4e1fc..ac39615 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
 "grunt": "1.0.1",
 "grunt-banana-checker": "0.4.0",
 "grunt-contrib-jshint": "0.11.3",
-"grunt-jscs": "1.8.0",
+"grunt-jscs": "2.1.0",
 "grunt-jsonlint": "1.0.7"
   }
 }
diff --git a/resources/head.js b/resources/head.js
index c92df69..44b935a 100644
--- a/resources/head.js
+++ b/resources/head.js
@@ -1,6 +1,7 @@
-/**
+/*!
  * JavaScript module for image-related metrics.
  * Top-loaded on every request to measure timing of events which might happen 
before normal script load.
+ *
  * @see https://mediawiki.org/wiki/Extension:ImageMetrics
  *
  * @licence GNU GPL v2 or later
diff --git a/resources/loader.js b/resources/loader.js
index f14adca..905f404 100644
--- a/resources/loader.js
+++ b/resources/loader.js
@@ -1,4 +1,4 @@
-/**
+/*!
  * JavaScript module for image-related metrics.
  * This module will be loaded on every request to perform sampling and load 
the real module if needed.
  * @see https://mediawiki.org/wiki/Extension:ImageMetrics
@@ -17,6 +17,7 @@
/**
 * Makes a random decision (based on samplingRatio) whether an event 
should be logged.
 * Returns true with 1/samplingRatio probability, or false if 
samplingRatio  is not a number or smaller than 1.
+*
 * @param {number|boolean} samplingRatio
 * @return {boolean}
 */
diff --git a/resources/logger/LoadingTimeLogger.js 
b/resources/logger/LoadingTimeLogger.js
index 8a2cd4e..6d686e2 100644
--- a/resources/logger/LoadingTimeLogger.js
+++ b/resources/logger/LoadingTimeLogger.js
@@ -1,4 +1,4 @@
-/**
+/*!
  * JavaScript module for image-related metrics.
  * @see https://mediawiki.org/wiki/Extension:ImageMetrics
  *
@@ -45,17 +45,22 @@
 
/**
 * Factory function to take care of dependency injection.
+*
 * @static
 * @param {number} samplingFactor sampling factor
 * @return {mw.imageMetrics.LoadingTimeLogger}
 */
LoadingTimeLogger.create = function ( samplingFactor ) {
+   // https://github.com/jscs-dev/jscs-jsdoc/issues/31
+   // jscs:disable
return new LoadingTimeLogger( samplingFactor, window.location, 
mw.config, window.Geo,
mw.eventLog, window.performance );
+   // jscs:enable
};
 
/**
 * Installs the event handler which will perform the logging.
+*
 * @static
 * @param {number} samplingFactor sampling factor
 */
@@ -100,17 +105,19 @@
 
/**
 * Adds navigation type (reload, back etc) to the log data from the 
NavigationTiming API.
+*
 * @param {Object} data
 */
LoadingTimeLogger.prototype.addNavigationTimingData = function ( data ) 
{
if ( this.performance.navigation && 
this.performance.navigation.type in this.navigationTypes ) {
-   data.navigationType = 
this.navigationTypes[this.performance.navigation.type];
+   data.navigationType = this.navigationTypes[ 
this.performance.navigation.type ];
}
};
 
/**
 * Returns timing data about the given file.
 * Requires ResourceTiming support - http://caniuse.com/resource-timing
+*
 * @param {jQuery} $file jQuery object containing the img element
 * @return {PerformanceResourceTiming|boolean} timing object or false 
if not supported
 */
@@ -122,7 +129,7 @@
}
 
url = $file.prop( 'src' ); // attr() might be relative, prop() 
is always absolute
-   timing = this.performance.getEntriesByName( url )[0];
+   timing = this.performance.getEntriesByName( url )[ 0 ];
if ( !timing ) {
return false;
}
@@ -136,6 +143,7 @@
 * - ownLoadingTime: net time it took the browser to load the image 
(PerformanceResourceTiming.duration)
 * - fullLoadingTime: total time from opening the page to finishing the 
image 

[MediaWiki-commits] [Gerrit] mediawiki...ImageMetrics[master]: build: bump grunt-jscs to 2.1.0

2017-08-01 Thread Hashar (Code Review)
Hashar has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/369341 )

Change subject: build: bump grunt-jscs to 2.1.0
..

build: bump grunt-jscs to 2.1.0

Avoids a peer dependency incompatibility with grunt
Update file comments /** -> /*! per T119193
Add new lines in comments

Ignore a jscs-jsdoc issue with return values since it does not detect
class inheritance:
https://github.com/jscs-dev/jscs-jsdoc/issues/31

Change-Id: If81ad41eaf4b3ea9405f15b8a2d20c4b83ba5a56
---
M package.json
M resources/head.js
M resources/loader.js
M resources/logger/LoadingTimeLogger.js
M resources/logger/Logger.js
5 files changed, 23 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ImageMetrics 
refs/changes/41/369341/1

diff --git a/package.json b/package.json
index 5e4e1fc..ac39615 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
 "grunt": "1.0.1",
 "grunt-banana-checker": "0.4.0",
 "grunt-contrib-jshint": "0.11.3",
-"grunt-jscs": "1.8.0",
+"grunt-jscs": "2.1.0",
 "grunt-jsonlint": "1.0.7"
   }
 }
diff --git a/resources/head.js b/resources/head.js
index c92df69..44b935a 100644
--- a/resources/head.js
+++ b/resources/head.js
@@ -1,6 +1,7 @@
-/**
+/*!
  * JavaScript module for image-related metrics.
  * Top-loaded on every request to measure timing of events which might happen 
before normal script load.
+ *
  * @see https://mediawiki.org/wiki/Extension:ImageMetrics
  *
  * @licence GNU GPL v2 or later
diff --git a/resources/loader.js b/resources/loader.js
index f14adca..905f404 100644
--- a/resources/loader.js
+++ b/resources/loader.js
@@ -1,4 +1,4 @@
-/**
+/*!
  * JavaScript module for image-related metrics.
  * This module will be loaded on every request to perform sampling and load 
the real module if needed.
  * @see https://mediawiki.org/wiki/Extension:ImageMetrics
@@ -17,6 +17,7 @@
/**
 * Makes a random decision (based on samplingRatio) whether an event 
should be logged.
 * Returns true with 1/samplingRatio probability, or false if 
samplingRatio  is not a number or smaller than 1.
+*
 * @param {number|boolean} samplingRatio
 * @return {boolean}
 */
diff --git a/resources/logger/LoadingTimeLogger.js 
b/resources/logger/LoadingTimeLogger.js
index 8a2cd4e..6d686e2 100644
--- a/resources/logger/LoadingTimeLogger.js
+++ b/resources/logger/LoadingTimeLogger.js
@@ -1,4 +1,4 @@
-/**
+/*!
  * JavaScript module for image-related metrics.
  * @see https://mediawiki.org/wiki/Extension:ImageMetrics
  *
@@ -45,17 +45,22 @@
 
/**
 * Factory function to take care of dependency injection.
+*
 * @static
 * @param {number} samplingFactor sampling factor
 * @return {mw.imageMetrics.LoadingTimeLogger}
 */
LoadingTimeLogger.create = function ( samplingFactor ) {
+   // https://github.com/jscs-dev/jscs-jsdoc/issues/31
+   // jscs:disable
return new LoadingTimeLogger( samplingFactor, window.location, 
mw.config, window.Geo,
mw.eventLog, window.performance );
+   // jscs:enable
};
 
/**
 * Installs the event handler which will perform the logging.
+*
 * @static
 * @param {number} samplingFactor sampling factor
 */
@@ -100,17 +105,19 @@
 
/**
 * Adds navigation type (reload, back etc) to the log data from the 
NavigationTiming API.
+*
 * @param {Object} data
 */
LoadingTimeLogger.prototype.addNavigationTimingData = function ( data ) 
{
if ( this.performance.navigation && 
this.performance.navigation.type in this.navigationTypes ) {
-   data.navigationType = 
this.navigationTypes[this.performance.navigation.type];
+   data.navigationType = this.navigationTypes[ 
this.performance.navigation.type ];
}
};
 
/**
 * Returns timing data about the given file.
 * Requires ResourceTiming support - http://caniuse.com/resource-timing
+*
 * @param {jQuery} $file jQuery object containing the img element
 * @return {PerformanceResourceTiming|boolean} timing object or false 
if not supported
 */
@@ -122,7 +129,7 @@
}
 
url = $file.prop( 'src' ); // attr() might be relative, prop() 
is always absolute
-   timing = this.performance.getEntriesByName( url )[0];
+   timing = this.performance.getEntriesByName( url )[ 0 ];
if ( !timing ) {
return false;
}
@@ -136,6 +143,7 @@
 * - ownLoadingTime: net time it took the browser to load the image 
(PerformanceResourceTiming.duration)
 * - fullLoadingTime: total time from opening the page to finishing