Merge pull request #804 from beenanner/typos-es-lint-fixes
Fixing a few typos and eslint warnings
This commit is contained in:
commit
e56db0c1d9
|
|
@ -209,7 +209,7 @@ function analyzeUrl(args, asyncDoneCallback) {
|
|||
fs.writeFile(jsonPath, JSON.stringify(data), cb);
|
||||
}
|
||||
},
|
||||
function(err5, results) {
|
||||
function(err5) {
|
||||
if (err5) {
|
||||
asyncDoneCallback(undefined, err5);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ var path = require('path'),
|
|||
moment = require('moment'),
|
||||
fs = require('fs-extra'),
|
||||
async = require('async'),
|
||||
EOL = require('os').EOL,
|
||||
urlParser = require('url'),
|
||||
winston = require('winston'),
|
||||
SitesHTMLRenderer = require('./sitesHTMLRenderer'),
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ AnalyzeOneSite.prototype.run = function(callback) {
|
|||
|
||||
/**
|
||||
This is the main flow of the application and this is what we do:
|
||||
1. Fetch the URL:s that will be analyzed, either we crawl a site using
|
||||
a start url or we read the URL:s from a file.
|
||||
2. Finetune the URL:s = do other thing that's needed, store them to disk etc.
|
||||
3. Let the analyser take a go at the URL:s, the analyzer
|
||||
1. Fetch the URL(s) that will be analyzed, either we crawl a site using
|
||||
a start url or we read the URL(s) from a file.
|
||||
2. Finetune the URL(s) = do other thing that's needed, store them to disk etc.
|
||||
3. Let the analyser take a go at the URL(s), the analyzer
|
||||
got a lot to do, lets check the analyzer.js file
|
||||
4. The analyze is finished, lets create output
|
||||
**/
|
||||
|
|
@ -82,8 +82,7 @@ AnalyzeOneSite.prototype.run = function(callback) {
|
|||
};
|
||||
|
||||
AnalyzeOneSite.prototype._fetchUrls = function(callback) {
|
||||
var self = this;
|
||||
// if we have an url configured, start crawling, else read the URL:s
|
||||
// if we have an url configured, start crawling, else read the URL(s)
|
||||
// from file
|
||||
if (this.config.urls) {
|
||||
this._getMultipleURLs(callback);
|
||||
|
|
@ -126,7 +125,7 @@ AnalyzeOneSite.prototype._verifyURL = function(callback) {
|
|||
};
|
||||
}
|
||||
|
||||
request(options, function(error, response, body) {
|
||||
request(options, function(error, response) {
|
||||
// request follow redirects and we want to end up
|
||||
if (!error && response.statusCode === 200) {
|
||||
callback(null, [self.config.url], []);
|
||||
|
|
@ -210,8 +209,6 @@ AnalyzeOneSite.prototype._getPostTasks = function(result) {
|
|||
};
|
||||
|
||||
AnalyzeOneSite.prototype._getResult = function(downloadErrors, analysisErrors) {
|
||||
var self = this;
|
||||
|
||||
this.log.log('info', 'Done analyzing urls');
|
||||
|
||||
// fetch all the data we need, and then generate the output
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ var cli = nomnom.help(
|
|||
},
|
||||
processJson: {
|
||||
metavar: '<PATH>',
|
||||
help: 'Pass the path to a result JSON that will be processed again. Use this to recongigure what to show in the HTML.',
|
||||
help: 'Pass the path to a result JSON that will be processed again. Use this to reconfigure what to show in the HTML.',
|
||||
hidden: true,
|
||||
transform: function(path) {
|
||||
return fileHelper.getFileAsJSON(path);
|
||||
|
|
@ -480,14 +480,14 @@ var cli = nomnom.help(
|
|||
}).parse();
|
||||
|
||||
if ((!cli.url) && (!cli.file) && (!cli.sites) && (!cli.configFile)) {
|
||||
console.log('You must specify either a URL to test, a file with URL:s or a config file');
|
||||
console.log('You must specify either a URL to test, a file with URL(s) or a config file');
|
||||
console.log(nomnom.getUsage());
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (cli.file) {
|
||||
cli.urls = fileHelper.getFileAsArray(cli.file);
|
||||
// are all URL:s valid?
|
||||
// are all URL(s) valid?
|
||||
var valid = true;
|
||||
cli.urls.forEach(function(url) {
|
||||
if (!validUrl.isWebUri(url)) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
'use strict';
|
||||
var util = require('../util/util'),
|
||||
RequestTiming = require('../requestTiming'),
|
||||
Stats = require('fast-stats').Stats,
|
||||
winston = require('winston');
|
||||
var domains = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ exports.setupDefaultValues = function(config) {
|
|||
|
||||
// to be able to run sitespeed.io you need a array of urls, a URL or a file
|
||||
if ((!config.url) && (!config.urls) && (!config.sites) && (!config.configFile)) {
|
||||
throw new Error('You must specify either a URL to test, a array with URL:s or a configuration file');
|
||||
throw new Error('You must specify either a URL to test, an array with URL(s) or a configuration file');
|
||||
}
|
||||
|
||||
// if we have default values not set in the config
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ module.exports.crawl = function(url, config, callback) {
|
|||
log.error('Error from the crawl: %s', s);
|
||||
});
|
||||
|
||||
crawl.on('close', function(code) {
|
||||
crawl.on('close', function() {
|
||||
// the crawler always return code ok today, hmm
|
||||
var okUrls = [];
|
||||
var errorUrls = {};
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@
|
|||
*/
|
||||
'use strict';
|
||||
var util = require('../util/util'),
|
||||
winston = require('winston'),
|
||||
net = require('net');
|
||||
winston = require('winston')
|
||||
|
||||
var navigationTimingNames = ['navigationStart',
|
||||
'unloadEventStart',
|
||||
|
|
@ -323,7 +322,7 @@ GraphiteCollector.prototype._getDomainStats = function(domains, hostname) {
|
|||
domains.forEach(function(domain) {
|
||||
timings.forEach(function(timing) {
|
||||
values.forEach(function(value) {
|
||||
// TODO we should use the protovol also in the key right
|
||||
// TODO we should use the protocol also in the key right
|
||||
stats += self.namespace + '.summary.' + hostname + '.domains.timings.' + domain.domain.split('.').join('_') +
|
||||
'.' +
|
||||
timing + '.' +
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
* Released under the Apache 2.0 License
|
||||
*/
|
||||
'use strict';
|
||||
var util = require('../util/util'),
|
||||
winston = require('winston'),
|
||||
var winston = require('winston'),
|
||||
net = require('net');
|
||||
|
||||
function GraphiteSender(host, port, config) {
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var path = require('path'),
|
||||
winston = require('winston'),
|
||||
fs = require('fs-extra'),
|
||||
var winston = require('winston'),
|
||||
request = require('request');
|
||||
|
||||
exports.task = function(result, config, cb) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ exports.task = function(result, config, cb) {
|
|||
render('detailed-site-summary', detailedData, config.run.absResultDir, callback);
|
||||
}
|
||||
},
|
||||
function(err, results) {
|
||||
function(err) {
|
||||
if (err) {
|
||||
log.error('Could not write summary files ' + err);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
var Stats = require('fast-stats').Stats;
|
||||
|
||||
/**
|
||||
* Create a a new request timing.
|
||||
* Create a new request timing.
|
||||
*
|
||||
* @param {Integer} time - the time this part took in ms.
|
||||
* @param {Integer} url - the url to the asset that took this time.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ var ySlowUtil = require('./util/yslowUtil'),
|
|||
util = require('./util/util'),
|
||||
simplehar = require('simplehar.sitespeed.io'),
|
||||
path = require('path'),
|
||||
fs = require('fs-extra'),
|
||||
winston = require('winston'),
|
||||
inspect = require('util').inspect,
|
||||
render = require('./util/htmlRenderer');
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ Sitespeed.prototype.run = function(config, finishedCb) {
|
|||
}
|
||||
],
|
||||
|
||||
function(err, results) {
|
||||
function(err) {
|
||||
if (err) {
|
||||
return finishedCb(err);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ TestRenderer.prototype.render = function(cb) {
|
|||
}
|
||||
}
|
||||
},
|
||||
function(err, results) {
|
||||
function(err) {
|
||||
if (err) {
|
||||
self.log.log('error', 'Error rendering budget ' + err);
|
||||
cb(err);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
// add a small md5-sum, taking care of URL:s with request parameters
|
||||
// add a small md5-sum, taking care of URL(s) with request parameters
|
||||
if (urlComponents.query) {
|
||||
name = name + crypto.createHash('md5').update(u).digest('hex').substr(0, 5);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue