From 645a2cd4420c0f44da92fb08f5304ee1f70b73ad Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Mon, 16 Mar 2015 00:27:14 +0100 Subject: [PATCH] 120 chars lines --- .jshintrc | 4 ++-- lib/cartodb/cartodb_windshaft.js | 11 ++++++++--- lib/cartodb/server_options.js | 29 +++++++++++++++++++---------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.jshintrc b/.jshintrc index 30101b4c..74f558f1 100644 --- a/.jshintrc +++ b/.jshintrc @@ -31,8 +31,8 @@ // "maxparams" : false, // {int} Max number of formal params allowed per function // "maxdepth" : false, // {int} Max depth of nested blocks (within functions) // "maxstatements" : false, // {int} Max number statements per function -// "maxcomplexity" : 8, // {int} Max cyclomatic complexity per function -// "maxlen" : 120, // {int} Max number of characters per line +// "maxcomplexity" : 6, // {int} Max cyclomatic complexity per function + "maxlen" : 120, // {int} Max number of characters per line // // // Relaxing // "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index bc797948..28e5c40d 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -26,7 +26,8 @@ var CartodbWindshaft = function(serverOptions) { var templateMaps = serverOptions.templateMaps; if(serverOptions.cache_enabled) { - console.log("cache invalidation enabled, varnish on ", serverOptions.varnish_host, ' ', serverOptions.varnish_port); + console.log("cache invalidation enabled, varnish on ", serverOptions.varnish_host, ' ', + serverOptions.varnish_port); Cache.init(serverOptions.varnish_host, serverOptions.varnish_port, serverOptions.varnish_secret); serverOptions.afterStateChange = function(req, data, callback) { Cache.invalidate_db(req.params.dbname, req.params.table); @@ -51,7 +52,10 @@ var CartodbWindshaft = function(serverOptions) { var SurrogateKeysCache = require('./cache/surrogate_keys_cache'), NamedMapsCacheEntry = require('./cache/model/named_maps_entry'), VarnishHttpCacheBackend = require('./cache/backend/varnish_http'), - varnishHttpCacheBackend = new VarnishHttpCacheBackend(serverOptions.varnish_host, serverOptions.varnish_http_port), + varnishHttpCacheBackend = new VarnishHttpCacheBackend( + serverOptions.varnish_host, + serverOptions.varnish_http_port + ), surrogateKeysCache = new SurrogateKeysCache(varnishHttpCacheBackend); function invalidateNamedMap (owner, templateName) { @@ -124,7 +128,8 @@ var CartodbWindshaft = function(serverOptions) { //console.log("Skipping cache channel in route:\n" + req.route.path); return false; } -//console.log("Adding cache channel to route\n" + req.route.path + " not matching any in:\n" + mapCreateRoutes.join("\n")); +//console.log("Adding cache channel to route\n" + req.route.path + " not matching any in:\n" + +// mapCreateRoutes.join("\n")); serverOptions.addCacheChannel(that, req, this); }, function sendResponse(err/*, added*/) { diff --git a/lib/cartodb/server_options.js b/lib/cartodb/server_options.js index 4daacc4b..92e04f4a 100644 --- a/lib/cartodb/server_options.js +++ b/lib/cartodb/server_options.js @@ -281,14 +281,16 @@ module.exports = function(redisPool) { }; me.beforeLayergroupCreate = function(req, requestMapConfig, callback) { - mapConfigNamedLayersAdapter.getLayers(this.userByReq(req), requestMapConfig.layers, pgConnection, function(err, layers, datasource) { - if (err) { - return callback(err); - } + mapConfigNamedLayersAdapter.getLayers(this.userByReq(req), requestMapConfig.layers, pgConnection, + function(err, layers, datasource) { + if (err) { + return callback(err); + } - requestMapConfig.layers = layers; - return callback(null, requestMapConfig, datasource); - }); + requestMapConfig.layers = layers; + return callback(null, requestMapConfig, datasource); + } + ); }; me.afterLayergroupCreate = function(req, mapconfig, response, callback) { @@ -408,7 +410,8 @@ module.exports = function(redisPool) { var layergroup_id = req.params.token; var auth_token = req.params.auth_token; - //console.log("Checking authorization from signer " + signer + " for resource " + layergroup_id + " with auth_token " + auth_token); + //console.log("Checking authorization from signer " + signer + " for resource " + layergroup_id + + // " with auth_token " + auth_token); var mapStore = req.app.mapStore; if (!mapStore) { throw new Error('Unable to retrieve map configuration token'); @@ -558,7 +561,12 @@ module.exports = function(redisPool) { //console.log("type of req.query.lzma is " + typeof(req.query.lzma)); // Decode (from base64) - var lzma = (new Buffer(req.query.lzma, 'base64').toString('binary')).split('').map(function(c) { return c.charCodeAt(0) - 128; }); + var lzma = new Buffer(req.query.lzma, 'base64') + .toString('binary') + .split('') + .map(function(c) { + return c.charCodeAt(0) - 128; + }); // Decompress lzmaWorker.decompress( @@ -597,7 +605,8 @@ module.exports = function(redisPool) { req.params.signer = tksplit.shift(); if ( ! req.params.signer ) req.params.signer = user; else if ( req.params.signer !== user ) { - var err = new Error('Cannot use map signature of user "' + req.params.signer + '" on database of user "' + user + '"'); + var err = new Error('Cannot use map signature of user "' + req.params.signer + '" on database of user "' + + user + '"'); err.http_status = 403; callback(err); return;