Skip to content

Commit

Permalink
lib,test: fix semicolon related linter errors
Browse files Browse the repository at this point in the history
See eslint/eslint#3075 regarding body-less
loops.
  • Loading branch information
silverwind committed Jul 19, 2015
1 parent e3cf1c9 commit bd5980d
Show file tree
Hide file tree
Showing 22 changed files with 42 additions and 27 deletions.
4 changes: 2 additions & 2 deletions lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
});
cb(null, mirror);
}
};
}
});
return;
} else if (handle.type === 'function') {
Expand Down Expand Up @@ -798,7 +798,7 @@ function Interface(stdin, stdout, args) {
} else {
self.repl.context[key] = fn;
}
};
}

// Copy all prototype methods in repl context
// Setup them as getters if possible
Expand Down
3 changes: 2 additions & 1 deletion lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ RoundRobinHandle.prototype.remove = function(worker) {
var index = this.free.indexOf(worker);
if (index !== -1) this.free.splice(index, 1);
if (Object.getOwnPropertyNames(this.all).length !== 0) return false;
for (var handle; handle = this.handles.shift(); handle.close());
var handle;
while (handle = this.handles.shift()) handle.close();
this.handle.close();
this.handle = null;
return true;
Expand Down
4 changes: 3 additions & 1 deletion lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,9 @@ Url.prototype.resolveObject = function(relative) {
!/^file:?$/.test(relative.protocol) &&
!hostlessProtocol[relative.protocol]) {
var relPath = (relative.pathname || '').split('/');
while (relPath.length && !(relative.host = relPath.shift()));
while(!(relative.host = relPath.shift())) {
if (!relPath.length || relative.host) break;
}
if (!relative.host) relative.host = '';
if (!relative.hostname) relative.hostname = '';
if (relPath[0] !== '') relPath.unshift('');
Expand Down
4 changes: 3 additions & 1 deletion test/addons/repl-domain-abort/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ var dInput = new stream.Readable();
var dOutput = new stream.Writable();

dInput._read = function _read(size) {
while (lines.length > 0 && this.push(lines.shift()));
while (lines.length > 0 && this.push(lines.shift())) {
// do nothing
}
if (lines.length === 0)
this.push(null);
};
Expand Down
2 changes: 1 addition & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ function leakedGlobals() {
leaked.push(val);

return leaked;
};
}
exports.leakedGlobals = leakedGlobals;

// Turn this off if the test should not check for global leaks.
Expand Down
2 changes: 1 addition & 1 deletion test/debugger/helper-debugger-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function addTest(input, output) {
} else {
quit();
}
};
}
expected.push({input: input, lines: output, callback: next});
}

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-1.0-keep-alive.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function check(tests) {
current++;
if (ctx.expectClose) return;
conn.removeListener('close', onclose);
conn.removeListener('data', ondata);;
conn.removeListener('data', ondata);
connected();
}
conn.on('data', ondata);
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-stream-big-packet.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var passed = false;

function PassThrough() {
stream.Transform.call(this);
};
}
util.inherits(PassThrough, stream.Transform);
PassThrough.prototype._transform = function(chunk, encoding, done) {
this.push(chunk);
Expand All @@ -17,7 +17,7 @@ PassThrough.prototype._transform = function(chunk, encoding, done) {

function TestStream() {
stream.Transform.call(this);
};
}
util.inherits(TestStream, stream.Transform);
TestStream.prototype._transform = function(chunk, encoding, done) {
if (!passed) {
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-stream-writable-decoded-encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var util = require('util');
function MyWritable(fn, options) {
stream.Writable.call(this, options);
this.fn = fn;
};
}

util.inherits(MyWritable, stream.Writable);

Expand All @@ -17,7 +17,7 @@ MyWritable.prototype._write = function(chunk, encoding, callback) {
callback();
};

;(function decodeStringsTrue() {
(function decodeStringsTrue() {
var m = new MyWritable(function(isBuffer, type, enc) {
assert(isBuffer);
assert.equal(type, 'object');
Expand All @@ -28,7 +28,7 @@ MyWritable.prototype._write = function(chunk, encoding, callback) {
m.end();
})();

;(function decodeStringsFalse() {
(function decodeStringsFalse() {
var m = new MyWritable(function(isBuffer, type, enc) {
assert(!isBuffer);
assert.equal(type, 'string');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-base64-single-char-read-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ src._read = function(n) {
src.push(new Buffer('1'));
src.push(null);
});
};
}
};

dst._write = function(chunk, enc, cb) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream3-pause-then-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function read100() {
function readn(n, then) {
console.error('read %d', n);
expectEndingData -= n;
;(function read() {
(function read() {
var c = r.read(n);
if (!c)
r.once('readable', read);
Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-tls-fast-writing.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ server.listen(PORT, function() {
}
function write() {
// this needs to return false eventually
while (false !== conn.write(chunk));
while (false !== conn.write(chunk)) {
// do nothing
}
}
});
2 changes: 1 addition & 1 deletion test/parallel/test-tls-npn-server-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function startTest() {

callback();
});
};
}

connectClient(clientsOptions[0], function() {
connectClient(clientsOptions[1], function() {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-tls-sni-option.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function startTest() {
else
connectClient(i + 1, callback);
}
};
}

connectClient(0, function() {
server.close();
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,6 @@ var throws = [
];
for (var i = 0; i < throws.length; i++) {
assert.throws(function() { url.format(throws[i]); }, TypeError);
};
}
assert(url.format('') === '');
assert(url.format({}) === '');
8 changes: 6 additions & 2 deletions test/parallel/test-zlib-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ var chunk1 = file.slice(0, chunkSize),

deflater.write(chunk1, function() {
deflater.params(0, zlib.Z_DEFAULT_STRATEGY, function() {
while (deflater.read());
while (deflater.read()) {
// do nothing
}
deflater.end(chunk2, function() {
var bufs = [], buf;
while (buf = deflater.read())
bufs.push(buf);
actual = Buffer.concat(bufs);
});
});
while (deflater.read());
while (deflater.read()) {
// do nothing
}
});

process.once('exit', function() {
Expand Down
4 changes: 3 additions & 1 deletion test/pummel/test-process-hrtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ assert(Array.isArray(start));

// busy-loop for 2 seconds
var now = Date.now();
while (Date.now() - now < 2000);
while (Date.now() - now < 2000) {
// do nothing
}

// get a diff reading
var diff = process.hrtime(start);
Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-tls-server-large-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var options = {
function Mediator() {
stream.Writable.call(this);
this.buf = '';
};
}
util.inherits(Mediator, stream.Writable);

Mediator.prototype._write = function write(data, enc, cb) {
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-child-process-fork-getconnections.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ if (process.argv[2] === 'child') {
closeSockets(i + 1);
});
});
};
}

var closeEmitted = false;
server.on('close', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-fs-watch-recursive.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (process.platform === 'darwin') {
function cleanup() {
try { fs.unlinkSync(filepathOne); } catch (e) { }
try { fs.rmdirSync(testsubdir); } catch (e) { }
};
}

try { fs.mkdirSync(testsubdir, 0o700); } catch (e) {}

Expand Down
4 changes: 3 additions & 1 deletion test/sequential/test-http-pipeline-flood.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ function child() {
});

function write() {
while (false !== conn.write(req, 'ascii'));
while (false !== conn.write(req, 'ascii')) {
// do nothing
}
}
}
2 changes: 1 addition & 1 deletion test/sequential/test-tcp-wrap-listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ server.onconnection = function(err, client) {
writeCount++;
console.log('write ' + writeCount);
maybeCloseClient();
};
}

sliceCount++;
} else {
Expand Down

0 comments on commit bd5980d

Please sign in to comment.