diff options
author | Mike Grundy <michael.grundy@10gen.com> | 2016-03-17 14:41:31 -0400 |
---|---|---|
committer | Mike Grundy <michael.grundy@10gen.com> | 2016-03-18 17:10:31 -0400 |
commit | 1be713cebbb9411d2977ec9996931a4508252af0 (patch) | |
tree | a199db2a273ebb5ca4289158ee5f63066cb3926a /src | |
parent | d82956a6fe2e7d5dd6216e66e95900d73dbf2e0c (diff) | |
download | mongo-1be713cebbb9411d2977ec9996931a4508252af0.tar.gz |
SERVER-23067 Final round of JS linting and formatting
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/.clang-format | 6 | ||||
-rw-r--r-- | src/mongo/shell/query.js | 12 | ||||
-rw-r--r-- | src/mongo/shell/servers_misc.js | 2 | ||||
-rw-r--r-- | src/mongo/shell/shardingtest.js | 54 | ||||
-rw-r--r-- | src/mongo/shell/types.js | 4 |
5 files changed, 40 insertions, 38 deletions
diff --git a/src/mongo/.clang-format b/src/mongo/.clang-format index a3b01b7f47d..04a485af039 100644 --- a/src/mongo/.clang-format +++ b/src/mongo/.clang-format @@ -63,15 +63,13 @@ UseTab: Never --- Language: JavaScript -# Disable JS formatting until the JS linter is in place (SERVER-22338) -DisableFormat: true # BasedOnStyle: Google # --- AccessModifierOffset: -1 AlignAfterOpenBracket: true AlignEscapedNewlinesLeft: true AlignOperands: false -AlignTrailingComments: false +AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false @@ -94,7 +92,7 @@ ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: true -#DisableFormat: false +DisableFormat: false ExperimentalAutoDetectBinPacking: false ForEachMacros: [ ] IndentCaseLabels: true diff --git a/src/mongo/shell/query.js b/src/mongo/shell/query.js index d18aeff12f6..b92f3b1f318 100644 --- a/src/mongo/shell/query.js +++ b/src/mongo/shell/query.js @@ -3,15 +3,15 @@ if (typeof DBQuery == "undefined") { DBQuery = function(mongo, db, collection, ns, query, fields, limit, skip, batchSize, options) { - this._mongo = mongo; // 0 - this._db = db; // 1 + this._mongo = mongo; // 0 + this._db = db; // 1 this._collection = collection; // 2 - this._ns = ns; // 3 + this._ns = ns; // 3 this._query = query || {}; // 4 - this._fields = fields; // 5 - this._limit = limit || 0; // 6 - this._skip = skip || 0; // 7 + this._fields = fields; // 5 + this._limit = limit || 0; // 6 + this._skip = skip || 0; // 7 this._batchSize = batchSize || 0; this._options = options || 0; diff --git a/src/mongo/shell/servers_misc.js b/src/mongo/shell/servers_misc.js index 8f3bff9d9e0..6f3defc54a3 100644 --- a/src/mongo/shell/servers_misc.js +++ b/src/mongo/shell/servers_misc.js @@ -201,7 +201,7 @@ allocatePorts = function(numPorts) { return ports; }; -function startParallelShell( jsCode, port, noConnect ) { +function startParallelShell(jsCode, port, noConnect) { var args = ["mongo"]; if (typeof db == "object") { diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index a167ac1c8e5..7f264dded30 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -31,7 +31,7 @@ * * config {number|Object|Array.<Object>}: number of config server or * config server configuration object(s)(*). @see MongoRunner.runMongod - * + * * (*) There are two ways For multiple configuration objects. * (1) Using the object format. Example: * @@ -57,7 +57,7 @@ * * shardOptions {Object}: same as the shards property above. * Can be used to specify options that are common all shards. - * + * * configOptions {Object}: same as the config property above. * Can be used to specify options that are common all config servers. * mongosOptions {Object}: same as the mongos property above. @@ -845,16 +845,18 @@ var ShardingTest = function(params) { this.stopMongod(n); if (otherParams.useBridge) { - var bridgeOptions = (opts !== mongod) ? opts.bridgeOptions - : mongod.fullOptions.bridgeOptions; + var bridgeOptions = + (opts !== mongod) ? opts.bridgeOptions : mongod.fullOptions.bridgeOptions; bridgeOptions = Object.merge(otherParams.bridgeOptions, bridgeOptions || {}); - bridgeOptions = Object.merge(bridgeOptions, { - hostName: otherParams.useHostname ? hostName : "localhost", - port: this._connections[n].port, - // The mongod processes identify themselves to mongobridge as host:port, where the - // host is the actual hostname of the machine and not localhost. - dest: hostName + ":" + opts.port, - }); + bridgeOptions = Object.merge( + bridgeOptions, + { + hostName: otherParams.useHostname ? hostName : "localhost", + port: this._connections[n].port, + // The mongod processes identify themselves to mongobridge as host:port, where the + // host is the actual hostname of the machine and not localhost. + dest: hostName + ":" + opts.port, + }); this._connections[n] = new MongoBridge(bridgeOptions); } @@ -1182,21 +1184,23 @@ var ShardingTest = function(params) { this._configServers = []; // Using replica set for config servers - var rstOptions = { useHostName : otherParams.useHostname, - useBridge : otherParams.useBridge, - bridgeOptions : otherParams.bridgeOptions, - keyFile : keyFile, - name: testName + "-configRS", - }; + var rstOptions = { + useHostName: otherParams.useHostname, + useBridge: otherParams.useBridge, + bridgeOptions: otherParams.bridgeOptions, + keyFile: keyFile, + name: testName + "-configRS", + }; // when using CSRS, always use wiredTiger as the storage engine - var startOptions = { pathOpts: pathOpts, - // Ensure that journaling is always enabled for config servers. - journal : "", - configsvr : "", - noJournalPrealloc : otherParams.nopreallocj, - storageEngine : "wiredTiger", - }; + var startOptions = { + pathOpts: pathOpts, + // Ensure that journaling is always enabled for config servers. + journal: "", + configsvr: "", + noJournalPrealloc: otherParams.nopreallocj, + storageEngine: "wiredTiger", + }; if (otherParams.configOptions && otherParams.configOptions.binVersion) { otherParams.configOptions.binVersion = @@ -1222,7 +1226,7 @@ var ShardingTest = function(params) { var initiateTimeout = otherParams.rsOptions && otherParams.rsOptions.initiateTimeout; this.configRS.initiate(config, null, initiateTimeout); - this.configRS.getPrimary(); // Wait for master to be elected before starting mongos + this.configRS.getPrimary(); // Wait for master to be elected before starting mongos this._configDB = this.configRS.getURL(); this._configServers = this.configRS.nodes; diff --git a/src/mongo/shell/types.js b/src/mongo/shell/types.js index 74019720909..d932b212cf9 100644 --- a/src/mongo/shell/types.js +++ b/src/mongo/shell/types.js @@ -98,8 +98,8 @@ ISODate = function(isoDateStr) { if (res[11] && res[11] != 'Z') { var ofs = 0; ofs += (parseInt(res[13], 10) || 0) * 60 * 60 * 1000; // hours - ofs += (parseInt(res[14], 10) || 0) * 60 * 1000; // mins - if (res[12] == '+') // if ahead subtract + ofs += (parseInt(res[14], 10) || 0) * 60 * 1000; // mins + if (res[12] == '+') // if ahead subtract ofs *= -1; time += ofs; |