Skip to content

Commit 6ad800d

Browse files
committed
one var per line
closes haraka#1173
1 parent aee705a commit 6ad800d

40 files changed

+200
-153
lines changed

.eslintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
},
55
"rules": {
66
"indent": [2, 4, {"SwitchCase": 1}],
7-
"space-after-keywords": [2, "always"],
7+
"one-var": [2, "never"],
88
"no-trailing-spaces": [2, { "skipBlankLines": false }],
9+
"space-after-keywords": [2, "always"],
910
}
1011
}

address.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ exports.domain_expr = undefined; // so you can override this when loading and re
4343
exports.qtext_expr = /[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]/;
4444
exports.text_expr = /\\([\x01-\x09\x0B\x0C\x0E-\x7F])/;
4545

46-
var domain_re, source_route_re, user_host_re, atoms_re, qt_re;
46+
var domain_re;
47+
var source_route_re;
48+
var user_host_re;
49+
var atoms_re;
50+
var qt_re;
4751

4852
exports.compile_re = function () {
4953
domain_re = exports.domain_expr || new RegExp (

config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ config.get('thing', type, cb, options);
3636
config.arrange_args = function (args) {
3737
var fs_name = args.shift();
3838
var fs_type = null;
39-
var cb, options;
39+
var cb;
40+
var options;
4041

4142
for (var i=0; i < args.length; i++) {
4243
if (args[i] === undefined) continue;

fsync_writestream.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ function FsyncWriteStream (path, options) {
1313

1414
util.inherits(FsyncWriteStream, fs.WriteStream);
1515

16-
var versions = process.version.split('.'),
17-
version = Number(versions[0].substring(1)),
18-
subversion = Number(versions[1]);
16+
var versions = process.version.split('.');
17+
var version = Number(versions[0].substring(1));
18+
var subversion = Number(versions[1]);
1919

2020
if (version > 0 || subversion >= 10) {
2121
// for v0.10+ compat
@@ -66,8 +66,8 @@ else {
6666

6767
this.busy = true;
6868

69-
var method = args.shift(),
70-
cb = args.pop();
69+
var method = args.shift();
70+
var cb = args.pop();
7171

7272
args.push(function(err) {
7373
self.busy = false;

net_utils.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ exports.ip_to_long = function (ip) {
134134
};
135135

136136
exports.octets_in_string = function (str, oct1, oct2) {
137-
var oct1_idx, oct2_idx;
137+
var oct1_idx;
138+
var oct2_idx;
138139

139140
// test the largest of the two octets first
140141
if (oct2.length >= oct1.length) {

outbound.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,9 @@ exports.send_email = function () {
351351
return this.send_trans_email(arguments[0], arguments[1]);
352352
}
353353

354-
var from = arguments[0],
355-
to = arguments[1],
356-
contents = arguments[2];
354+
var from = arguments[0];
355+
var to = arguments[1];
356+
var contents = arguments[2];
357357
var next = arguments[3];
358358
var options = arguments[4];
359359

@@ -1229,10 +1229,10 @@ HMailItem.prototype.try_deliver_host_on_socket = function (mx, host, port, socke
12291229
var matches = smtp_regexp.exec(line);
12301230
if (matches) {
12311231
var reason;
1232-
var code = matches[1],
1233-
cont = matches[2],
1234-
extc = matches[3],
1235-
rest = matches[4];
1232+
var code = matches[1];
1233+
var cont = matches[2];
1234+
var extc = matches[3];
1235+
var rest = matches[4];
12361236
response.push(rest);
12371237
if (cont === ' ') {
12381238
if (code.match(/^2/)) {

plugins.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ plugins.server = { notes: {} };
185185
plugins._load_and_compile_plugin = function (name) {
186186
var plugin = new Plugin(name);
187187
var fp = plugin.full_paths;
188-
var rf, last_err, hasPackageJson;
188+
var rf;
189+
var last_err;
190+
var hasPackageJson;
189191
for (var i=0, j=fp.length; i<j; i++) {
190192
try {
191193
rf = fs.readFileSync(fp[i]);

plugins/auth/auth_proxy.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ exports.try_auth_proxy = function (connection, hosts, user, passwd, cb) {
9090
var matches;
9191
connection.logprotocol(self, "S: " + line);
9292
if (matches = smtp_regexp.exec(line)) {
93-
var code = matches[1],
94-
cont = matches[2],
95-
rest = matches[3];
93+
var code = matches[1];
94+
var cont = matches[2];
95+
var rest = matches[3];
9696
response.push(rest);
9797
if (cont === ' ') {
9898
connection.logdebug(self, 'command state: ' + command);

plugins/auth/auth_vpopmaild.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Auth against vpopmaild
22

3-
var net = require('net'),
4-
crypto = require('crypto');
3+
var net = require('net');
4+
var crypto = require('crypto');
55

66
exports.register = function () {
77
var plugin = this;

plugins/avg.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ exports.hook_data_post = function (next, connection) {
100100
return do_next(DENYSOFT, 'Virus scanner error (AVG)');
101101
}
102102

103-
var code = matches[1],
104-
cont = matches[2],
105-
rest = matches[3];
103+
var code = matches[1];
104+
var cont = matches[2];
105+
var rest = matches[3];
106106
response.push(rest);
107107
if (cont !== ' ') { return; }
108108

plugins/clamd.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ exports.hook_data_post = function (next, connection) {
222222
socket.on('connect', function () {
223223
connected = true;
224224
socket.setTimeout((cfg.main.timeout || 30) * 1000);
225-
var hp = socket.address(),
226-
addressInfo = hp === null ? '' : ' ' + hp.address + ':' + hp.port;
225+
var hp = socket.address();
226+
var addressInfo = hp === null ? '' : ' ' + hp.address + ':' + hp.port;
227227
connection.logdebug(plugin, 'connected to host' + addressInfo);
228228
socket.write("zINSTREAM\0", function () {
229229
txn.message_stream.pipe(socket, { clamd_style: true });

plugins/dkim_sign.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// dkim_signer
22
// Implements DKIM core as per www.dkimcore.org
33

4-
var addrparser = require('address-rfc2822'),
5-
async = require('async'),
6-
crypto = require('crypto'),
7-
fs = require('fs'),
8-
Stream = require('stream').Stream,
9-
util = require('util'),
10-
utils = require('./utils');
4+
var addrparser = require('address-rfc2822');
5+
var async = require('async');
6+
var crypto = require('crypto');
7+
var fs = require('fs');
8+
var Stream = require('stream').Stream;
9+
var util = require('util');
10+
var utils = require('./utils');
1111

1212
function DKIMSignStream(selector, domain, private_key, headers_to_sign, header, end_callback) {
1313
Stream.call(this);
@@ -167,7 +167,9 @@ exports.hook_queue_outbound = function (next, connection) {
167167
if (plugin.cfg.main.disabled) { return next(); }
168168

169169
plugin.get_key_dir(connection, function(keydir) {
170-
var domain, selector, private_key;
170+
var domain;
171+
var selector;
172+
var private_key;
171173
if (!keydir) {
172174
domain = plugin.cfg.main.domain;
173175
private_key = plugin.private_key;

plugins/queue/rabbitmq.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ exports.init_rabbitmq_server = function() {
123123
logger.logdebug("connQueue with server "+connQueue);
124124

125125
//Creating the Routing key to bind the queue and exchange.
126-
var key, routing;
126+
var key;
127+
var routing;
127128
routing = "" + queueName + "Routing";
128129

129130
// Will try to bing queue and exchange which was created above.

plugins/queue/rabbitmq_amqplib.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
var amqp = require("amqplib/callback_api");
44

5-
var channel,
6-
queue,
7-
deliveryMode;
5+
var channel;
6+
var queue;
7+
var deliveryMode;
88

99
exports.register = function () {
1010
this.init_amqp_connection();
@@ -22,16 +22,16 @@ exports.hook_queue = function(next, connection) {
2222
exports.init_amqp_connection = function() {
2323
var cfg = this.config.get("rabbitmq.ini").rabbitmq;
2424

25-
var host = cfg.host || "127.0.0.1",
26-
port = cfg.port || "5672",
27-
user = cfg.user || "guest",
28-
password = cfg.password || "guest",
29-
exchangeName = cfg.exchangeName || "emailMessages",
30-
exchangeType = cfg.exchangeType || "direct",
31-
queueName = cfg.queueName || "emails",
32-
durable = cfg.durable === "true" || true,
33-
// confirm = cfg.confirm === "true" || true,
34-
autoDelete = cfg.autoDelete === "true" || false;
25+
var host = cfg.host || "127.0.0.1";
26+
var port = cfg.port || "5672";
27+
var user = cfg.user || "guest";
28+
var password = cfg.password || "guest";
29+
var exchangeName = cfg.exchangeName || "emailMessages";
30+
var exchangeType = cfg.exchangeType || "direct";
31+
var queueName = cfg.queueName || "emails";
32+
var durable = cfg.durable === "true" || true;
33+
// var confirm = cfg.confirm === "true" || true;
34+
var autoDelete = cfg.autoDelete === "true" || false;
3535
deliveryMode = cfg.deliveryMode || 2;
3636

3737
amqp.connect("amqp://"+user+":"+password+"@"+host+":"+port, function(err, conn){

plugins/rate_limit.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ exports.lookup_mail_key = function (type, args, cb) {
111111

112112
exports.rate_limit = function (connection, key, value, cb) {
113113
var self = this;
114-
var limit, ttl;
114+
var limit;
115+
var ttl;
115116
if (!key || !value) return cb();
116117
if (value === 0) {
117118
// Limit disabled for this host

plugins/relay.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//
33
// documentation via: haraka -h relay
44

5-
var ipaddr = require('ipaddr.js'),
6-
net = require('net');
5+
var ipaddr = require('ipaddr.js');
6+
var net = require('net');
77

88
exports.register = function() {
99
var plugin = this;

plugins/relay_acl.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
// documentation via: haraka -h plugins/relay_acl
44

5-
var ipaddr = require('ipaddr.js'),
6-
net = require('net');
5+
var ipaddr = require('ipaddr.js');
6+
var net = require('net');
77

88
exports.register = function() {
99
this.logerror(this, "deprecated. see 'haraka -h relay'");

plugins/reseed_rng.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,12 @@
166166
//
167167
/** @constructor */
168168
function ARC4(key) {
169-
var t, u, me = this, keylen = key.length;
170-
var i = 0, j = me.i = me.j = me.m = 0;
169+
var t;
170+
var u;
171+
var me = this;
172+
var keylen = key.length;
173+
var i = 0;
174+
var j = me.i = me.j = me.m = 0;
171175
me.S = [];
172176
me.c = [];
173177

plugins/watch/html/client.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
/* jshint jquery: true, maxlen: 130 */
33
/* global window, XMLHttpRequest, WebSocket */
44

5-
var ws, connect_cols, helo_cols, mail_from_cols, rcpt_to_cols, data_cols, total_cols;
6-
var cxn_cols, txn_cols;
5+
var ws;
6+
var connect_cols;
7+
var helo_cols;
8+
var mail_from_cols;
9+
var rcpt_to_cols;
10+
var data_cols;
11+
var total_cols;
12+
var cxn_cols;
13+
var txn_cols;
714

815
var connect_plugins = ['connect.geoip','connect.p0f','connect.asn','dnsbl', 'early', 'connect.fcrdns'];
916
var helo_plugins = ['helo.checks','tls','auth','relay','spf'];
@@ -48,7 +55,8 @@ function newRowConnectRow2 (data, uuid, txnId) {
4855
var res = [];
4956
connect_plugins.forEach(function(plugin) {
5057
var nv = shorten_pi(plugin);
51-
var newc = '', tit = '';
58+
var newc = '';
59+
var tit = '';
5260
if (data[plugin]) { // not always updated
5361
if (data[plugin].classy) newc = data[plugin].classy;
5462
if (data[plugin].newval) nv = data[plugin].newval;

plugins/watch/html/jquery.tipsy.js

+16-14
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272
});
7373
}
7474

75-
var actualWidth = $tip[0].offsetWidth,
76-
actualHeight = $tip[0].offsetHeight,
77-
gravity = maybeCall(this.options.gravity, this.$element[0]);
75+
var actualWidth = $tip[0].offsetWidth;
76+
var actualHeight = $tip[0].offsetHeight;
77+
var gravity = maybeCall(this.options.gravity, this.$element[0]);
7878

7979
var tp;
8080
switch (gravity.charAt(0)) {
@@ -141,7 +141,9 @@
141141
},
142142

143143
getTitle: function() {
144-
var title, $e = this.$element, o = this.options;
144+
var title;
145+
var $e = this.$element;
146+
var o = this.options;
145147
this.fixTitle();
146148
if (typeof o.title == 'string') {
147149
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
@@ -230,8 +232,8 @@
230232
if (!options.live) this.each(function() { get(this); });
231233

232234
if (options.trigger != 'manual') {
233-
var eventIn = options.trigger == 'hover' ? 'mouseenter mouseover' : 'focus',
234-
eventOut = options.trigger == 'hover' ? 'mouseleave mouseout' : 'blur';
235+
var eventIn = options.trigger == 'hover' ? 'mouseenter mouseover' : 'focus';
236+
var eventOut = options.trigger == 'hover' ? 'mouseleave mouseout' : 'blur';
235237

236238
if (options.live && options.live !== true) {
237239
$(this).on(eventIn, options.live, enter);
@@ -331,10 +333,10 @@
331333
*/
332334
$.fn.tipsy.autoBounds = function(marginNorth, marginEast, prefer) {
333335
return function() {
334-
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
335-
boundTop = $(document).scrollTop() + marginNorth,
336-
boundLeft = $(document).scrollLeft() + marginEast,
337-
$this = $(this);
336+
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)};
337+
var boundTop = $(document).scrollTop() + marginNorth;
338+
var boundLeft = $(document).scrollLeft() + marginEast;
339+
var $this = $(this);
338340

339341
if ($this.offset().top < boundTop) dir.ns = 'n';
340342
if ($this.offset().left < boundLeft) dir.ew = 'w';
@@ -354,10 +356,10 @@
354356
*/
355357
$.fn.tipsy.autoBounds2 = function(margin, prefer) {
356358
return function() {
357-
var dir = {},
358-
boundTop = $(document).scrollTop() + margin,
359-
boundLeft = $(document).scrollLeft() + margin,
360-
$this = $(this);
359+
var dir = {};
360+
var boundTop = $(document).scrollTop() + margin;
361+
var boundLeft = $(document).scrollLeft() + margin;
362+
var $this = $(this);
361363

362364
// bi-directional string (ne, se, sw, etc...)
363365
if (prefer.length > 1) {

plugins/watch/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ function get_mailfrom(txn) {
456456

457457
function get_recipients(txn) {
458458

459-
var d = [], t = [];
459+
var d = [];
460+
var t = [];
460461
txn.rcpt_to.forEach(function (ea) {
461462
try { var rcpt = ea.address(); }
462463
catch (ignore) { }

result_store.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ ResultStore.prototype.get_all = function () {
166166
};
167167

168168
ResultStore.prototype.private_collate = function (result, name) {
169-
var r = [], order = [], hide = [];
169+
var r = [];
170+
var order = [];
171+
var hide = [];
170172

171173
if (cfg[name]) {
172174
if (cfg[name].hide) hide = cfg[name].hide.trim().split(/[,; ]+/);

0 commit comments

Comments
 (0)