Skip to content

Commit

Permalink
Fix space-before-function-paren linter rule
Browse files Browse the repository at this point in the history
  • Loading branch information
HeeL committed Oct 13, 2016
1 parent 3fa1c1f commit 4a3c31b
Show file tree
Hide file tree
Showing 385 changed files with 6,621 additions and 6,622 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Expand Up @@ -56,7 +56,6 @@
"indent": "off",
"func-names": "off",
"prefer-arrow-callback": "off",
"space-before-function-paren": "off",
"object-curly-spacing": "off",
"no-var": "off",
"no-shadow": "off",
Expand Down
6 changes: 3 additions & 3 deletions Gruntfile.js
Expand Up @@ -6,7 +6,7 @@ var fork = require('child_process').fork,
incomplete = [];


module.exports = function(grunt) {
module.exports = function (grunt) {
var args = [];
if (!grunt.option('verbose')) {
args.push('--log-level=info');
Expand Down Expand Up @@ -34,7 +34,7 @@ module.exports = function(grunt) {
fromFile = ['clientLess', 'acpLess', 'js', 'tpl'];
}

fromFile = fromFile.filter(function(ext) {
fromFile = fromFile.filter(function (ext) {
return incomplete.indexOf(ext) === -1;
});

Expand All @@ -44,7 +44,7 @@ module.exports = function(grunt) {
worker.kill();
worker = fork('app.js', updateArgs, { env: env });

worker.on('message', function() {
worker.on('message', function () {
if (incomplete.length) {
incomplete = [];

Expand Down
24 changes: 12 additions & 12 deletions app.js
Expand Up @@ -36,7 +36,7 @@ global.env = process.env.NODE_ENV || 'production';
winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, {
colorize: true,
timestamp: function() {
timestamp: function () {
var date = new Date();
return date.getDate() + '/' + (date.getMonth() + 1) + ' ' + date.toTimeString().substr(0,5) + ' [' + global.process.pid + ']';
},
Expand Down Expand Up @@ -146,7 +146,7 @@ function start() {
process.on('SIGTERM', shutdown);
process.on('SIGINT', shutdown);
process.on('SIGHUP', restart);
process.on('message', function(message) {
process.on('message', function (message) {
if (typeof message !== 'object') {
return;
}
Expand All @@ -173,7 +173,7 @@ function start() {
}
});

process.on('uncaughtException', function(err) {
process.on('uncaughtException', function (err) {
winston.error(err.stack);
console.log(err.stack);

Expand All @@ -184,21 +184,21 @@ function start() {
async.waterfall([
async.apply(db.init),
async.apply(db.checkCompatibility),
function(next) {
function (next) {
require('./src/meta').configs.init(next);
},
function(next) {
function (next) {
if (nconf.get('dep-check') === undefined || nconf.get('dep-check') !== false) {
require('./src/meta').dependencies.check(next);
} else {
winston.warn('[init] Dependency checking skipped!');
setImmediate(next);
}
},
function(next) {
function (next) {
require('./src/upgrade').check(next);
},
function(next) {
function (next) {
var webserver = require('./src/webserver');
require('./src/socket.io').init(webserver.server);

Expand All @@ -209,7 +209,7 @@ function start() {

webserver.listen();
}
], function(err) {
], function (err) {
if (err) {
switch(err.message) {
case 'schema-out-of-date':
Expand Down Expand Up @@ -280,7 +280,7 @@ function setup() {
}

function upgrade() {
require('./src/database').init(function(err) {
require('./src/database').init(function (err) {
if (err) {
winston.error(err.stack);
process.exit();
Expand All @@ -292,7 +292,7 @@ function upgrade() {
}

function activate() {
require('./src/database').init(function(err) {
require('./src/database').init(function (err) {
if (err) {
winston.error(err.stack);
process.exit(1);
Expand All @@ -308,15 +308,15 @@ function activate() {
}

function listPlugins() {
require('./src/database').init(function(err) {
require('./src/database').init(function (err) {
if (err) {
winston.error(err.stack);
process.exit(1);
}

var db = require('./src/database');

db.getSortedSetRange('plugins:active', 0, -1, function(err, plugins) {
db.getSortedSetRange('plugins:active', 0, -1, function (err, plugins) {
if (err) {
winston.error(err.stack);
process.exit(1);
Expand Down
6 changes: 3 additions & 3 deletions bcrypt.js
Expand Up @@ -5,7 +5,7 @@ var bcrypt = require('bcryptjs'),
async = require('async');


process.on('message', function(msg) {
process.on('message', function (msg) {
if (msg.type === 'hash') {
hashPassword(msg.password, msg.rounds);
} else if (msg.type === 'compare') {
Expand All @@ -15,10 +15,10 @@ process.on('message', function(msg) {

function hashPassword(password, rounds) {
async.waterfall([
function(next) {
function (next) {
bcrypt.genSalt(parseInt(rounds, 10), next);
},
function(salt, next) {
function (salt, next) {
bcrypt.hash(password, salt, next);
}
], done);
Expand Down
2 changes: 1 addition & 1 deletion install/databases.js
Expand Up @@ -9,7 +9,7 @@ var questions = {
mongo: require('../src/database/mongo').questions
};

module.exports = function(config, callback) {
module.exports = function (config, callback) {
async.waterfall([
function (next) {
process.stdout.write('\n');
Expand Down
18 changes: 9 additions & 9 deletions install/web.js
Expand Up @@ -15,7 +15,7 @@ var server;
winston.add(winston.transports.File, {
filename: 'logs/webinstall.log',
colorize: true,
timestamp: function() {
timestamp: function () {
var date = new Date();
return date.getDate() + '/' + (date.getMonth() + 1) + ' ' + date.toTimeString().substr(0,5) + ' [' + global.process.pid + ']';
},
Expand All @@ -30,7 +30,7 @@ var scripts = [
'public/src/installer/install.js'
];

web.install = function(port) {
web.install = function (port) {
port = port || 4567;
winston.info('Launching web installer on port', port);

Expand All @@ -42,15 +42,15 @@ web.install = function(port) {
extended: true
}));

async.parallel([compileLess, compileJS], function() {
async.parallel([compileLess, compileJS], function () {
setupRoutes();
launchExpress(port);
});
};


function launchExpress(port) {
server = app.listen(port, function() {
server = app.listen(port, function () {
winston.info('Web installer listening on http://%s:%s', '0.0.0.0', port);
});
}
Expand All @@ -63,7 +63,7 @@ function setupRoutes() {

function welcome(req, res) {
var dbs = ['redis', 'mongo'];
var databases = dbs.map(function(el) {
var databases = dbs.map(function (el) {
return {
name: el,
questions: require('../src/database/' + el).questions
Expand Down Expand Up @@ -93,7 +93,7 @@ function install(req, res) {
env: process.env
});

child.on('close', function(data) {
child.on('close', function (data) {
if (data === 0) {
res.locals.success = true;
} else {
Expand Down Expand Up @@ -129,12 +129,12 @@ function compileLess(callback) {
return callback(false);
}

fs.readFile(path.join(__dirname, '../public/less/install.less'), function(err, style) {
fs.readFile(path.join(__dirname, '../public/less/install.less'), function (err, style) {
if (err) {
return winston.error('Unable to read LESS install file: ', err);
}

less.render(style.toString(), function(err, css) {
less.render(style.toString(), function (err, css) {
if(err) {
return winston.error('Unable to compile LESS: ', err);
}
Expand All @@ -151,7 +151,7 @@ function compileJS(callback) {
}

var scriptPath = path.join(__dirname, '..');
var result = uglify.minify(scripts.map(function(script) {
var result = uglify.minify(scripts.map(function (script) {
return path.join(scriptPath, script);
}));

Expand Down
34 changes: 17 additions & 17 deletions loader.js
Expand Up @@ -33,9 +33,9 @@ var pidFilePath = __dirname + '/pidfile',
templatesCompiled: false
};

Loader.init = function(callback) {
Loader.init = function (callback) {
if (silent) {
console.log = function() {
console.log = function () {
var args = Array.prototype.slice.call(arguments);
output.write(args.join(' ') + '\n');
};
Expand All @@ -47,7 +47,7 @@ Loader.init = function(callback) {
callback();
};

Loader.displayStartupMessages = function(callback) {
Loader.displayStartupMessages = function (callback) {
console.log('');
console.log('NodeBB v' + pkg.version + ' Copyright (C) 2013-2014 NodeBB Inc.');
console.log('This program comes with ABSOLUTELY NO WARRANTY.');
Expand All @@ -57,16 +57,16 @@ Loader.displayStartupMessages = function(callback) {
callback();
};

Loader.addWorkerEvents = function(worker) {
Loader.addWorkerEvents = function (worker) {

worker.on('exit', function(code, signal) {
worker.on('exit', function (code, signal) {
if (code !== 0) {
if (Loader.timesStarted < numProcs * 3) {
Loader.timesStarted++;
if (Loader.crashTimer) {
clearTimeout(Loader.crashTimer);
}
Loader.crashTimer = setTimeout(function() {
Loader.crashTimer = setTimeout(function () {
Loader.timesStarted = 0;
}, 10000);
} else {
Expand All @@ -83,7 +83,7 @@ Loader.addWorkerEvents = function(worker) {
}
});

worker.on('message', function(message) {
worker.on('message', function (message) {
if (message && typeof message === 'object' && message.action) {
switch (message.action) {
case 'ready':
Expand Down Expand Up @@ -148,7 +148,7 @@ Loader.addWorkerEvents = function(worker) {
});
};

Loader.start = function(callback) {
Loader.start = function (callback) {
numProcs = getPorts().length;
console.log('Clustering enabled: Spinning up ' + numProcs + ' process(es).\n');

Expand Down Expand Up @@ -205,38 +205,38 @@ function getPorts() {
return port;
}

Loader.restart = function() {
Loader.restart = function () {
killWorkers();
nconf.remove('file');
nconf.use('file', { file: path.join(__dirname, '/config.json') });
Loader.start();
};

Loader.reload = function() {
workers.forEach(function(worker) {
Loader.reload = function () {
workers.forEach(function (worker) {
worker.send({
action: 'reload'
});
});
};

Loader.stop = function() {
Loader.stop = function () {
killWorkers();

// Clean up the pidfile
fs.unlinkSync(__dirname + '/pidfile');
};

function killWorkers() {
workers.forEach(function(worker) {
workers.forEach(function (worker) {
worker.suicide = true;
worker.kill();
});
}

Loader.notifyWorkers = function(msg, worker_pid) {
Loader.notifyWorkers = function (msg, worker_pid) {
worker_pid = parseInt(worker_pid, 10);
workers.forEach(function(worker) {
workers.forEach(function (worker) {
if (parseInt(worker.pid, 10) !== worker_pid) {
try {
worker.send(msg);
Expand All @@ -247,7 +247,7 @@ Loader.notifyWorkers = function(msg, worker_pid) {
});
};

fs.open(path.join(__dirname, 'config.json'), 'r', function(err) {
fs.open(path.join(__dirname, 'config.json'), 'r', function (err) {
if (!err) {
if (nconf.get('daemon') !== 'false' && nconf.get('daemon') !== false) {
if (file.existsSync(pidFilePath)) {
Expand All @@ -272,7 +272,7 @@ fs.open(path.join(__dirname, 'config.json'), 'r', function(err) {
Loader.init,
Loader.displayStartupMessages,
Loader.start
], function(err) {
], function (err) {
if (err) {
console.log('[loader] Error during startup: ' + err.message);
}
Expand Down

0 comments on commit 4a3c31b

Please sign in to comment.