From 7b13c12ab454595f3440f9002ce0ddde08e257e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Wed, 13 Nov 2019 20:07:41 +0100 Subject: [PATCH] Automatically lint fixes --- lib/api/api-router.js | 6 ++-- lib/models/dataview/overviews/aggregation.js | 2 +- .../adapter/mapconfig-named-layers-adapter.js | 4 +-- lib/utils/query-utils.js | 2 +- test/acceptance/dataviews/overviews-test.js | 35 ++++++++++--------- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/lib/api/api-router.js b/lib/api/api-router.js index ff37edd7..ad89d0a3 100644 --- a/lib/api/api-router.js +++ b/lib/api/api-router.js @@ -85,9 +85,9 @@ module.exports = class ApiRouter { const metadataBackend = cartodbRedis({ pool: redisPool }); const pgConnection = new PgConnection(metadataBackend); - const windshaftLogger = environmentOptions.log_windshaft && global.log4js ? - global.log4js.getLogger('[windshaft]') : - null; + const windshaftLogger = environmentOptions.log_windshaft && global.log4js + ? global.log4js.getLogger('[windshaft]') + : null; const mapStore = new windshaft.storage.MapStore({ pool: redisPool, expire_time: serverOptions.grainstore.default_layergroup_ttl, diff --git a/lib/models/dataview/overviews/aggregation.js b/lib/models/dataview/overviews/aggregation.js index 1ded6723..dc5fbcdc 100644 --- a/lib/models/dataview/overviews/aggregation.js +++ b/lib/models/dataview/overviews/aggregation.js @@ -241,7 +241,7 @@ Aggregation.prototype._checkOptions = function (options) { } }; -Aggregation.prototype.getAggregationSql = function() { +Aggregation.prototype.getAggregationSql = function () { return aggregationFnQueryTpl[this.aggregation]({ _aggregationFn: this.aggregation, _aggregationColumn: this.aggregationColumn || 1 diff --git a/lib/models/mapconfig/adapter/mapconfig-named-layers-adapter.js b/lib/models/mapconfig/adapter/mapconfig-named-layers-adapter.js index 065ae7c4..4d0b5786 100644 --- a/lib/models/mapconfig/adapter/mapconfig-named-layers-adapter.js +++ b/lib/models/mapconfig/adapter/mapconfig-named-layers-adapter.js @@ -90,10 +90,10 @@ MapConfigNamedLayersAdapter.prototype.getMapConfig = function (user, requestMapC if (layersResult.datasource) { datasourceBuilder.withLayerDatasource(currentLayerIndex, { user: dbAuth.dbuser, - // Used internally (PSQL) + // Used internally (PSQL) pass: dbAuth.dbpassword, dbpassword: dbAuth.dbpassword, - // Used by Mapnik + // Used by Mapnik password: dbAuth.dbpassword }); } diff --git a/lib/utils/query-utils.js b/lib/utils/query-utils.js index 47de5686..02c0b28d 100644 --- a/lib/utils/query-utils.js +++ b/lib/utils/query-utils.js @@ -7,7 +7,7 @@ module.exports.getQueryActualRowCount = function (query) { return `select COUNT(*) AS rows FROM (${substituteDummyTokens(query)}) AS __cdb_query`; }; -function getQueryRowEstimation(query) { +function getQueryRowEstimation (query) { return 'select cartodb.CDB_EstimateRowCount($windshaft$' + substituteDummyTokens(query) + '$windshaft$) as rows'; } module.exports.getQueryRowEstimation = getQueryRowEstimation; diff --git a/test/acceptance/dataviews/overviews-test.js b/test/acceptance/dataviews/overviews-test.js index 79f7531d..e53c5bc4 100644 --- a/test/acceptance/dataviews/overviews-test.js +++ b/test/acceptance/dataviews/overviews-test.js @@ -658,7 +658,7 @@ describe('dataviews using tables with overviews', function () { }); }); - describe('agreggation validation', function (){ + describe('agreggation validation', function () { const params = { response: { status: 400, @@ -668,21 +668,22 @@ describe('dataviews using tables with overviews', function () { } }; - function createMapConfig(options) { + function createMapConfig (options) { return { version: '1.8.0', analyses: [ - { id: 'data-source', + { + id: 'data-source', type: 'source', params: { query: 'select * from test_table_overviews' } } ], - dataviews: { + dataviews: { test_invalid_aggregation: { type: 'aggregation', - source: {id: 'data-source'}, + source: { id: 'data-source' }, options: options } }, @@ -702,8 +703,8 @@ describe('dataviews using tables with overviews', function () { it('should fail if missing column', function (done) { var options = { - aggregation: "sum", - aggregationColumn: "value" + aggregation: 'sum', + aggregationColumn: 'value' }; var missingColumnMapConfig = createMapConfig(options); @@ -727,8 +728,8 @@ describe('dataviews using tables with overviews', function () { it('should fail if no aggregation operation', function (done) { var options = { - column: "value", - aggregationColumn: "value" + column: 'value', + aggregationColumn: 'value' }; var missingOperationMapConfig = createMapConfig(options); @@ -752,9 +753,9 @@ describe('dataviews using tables with overviews', function () { it('should fail if fake operation', function (done) { var options = { - column: "value", - aggregation: "wadus", - aggregationColumn: "value" + column: 'value', + aggregation: 'wadus', + aggregationColumn: 'value' }; var wrongOperationMapConfig = createMapConfig(options); @@ -778,9 +779,9 @@ describe('dataviews using tables with overviews', function () { it('should fail if invalid operation for overview', function (done) { var options = { - column: "value", - aggregation: "avg", - aggregationColumn: "value" + column: 'value', + aggregation: 'avg', + aggregationColumn: 'value' }; var wrongOperationMapConfig = createMapConfig(options); @@ -804,8 +805,8 @@ describe('dataviews using tables with overviews', function () { it('should fail if no aggregation column when needed', function (done) { var options = { - column: "value", - aggregation: "sum" + column: 'value', + aggregation: 'sum' }; var missingOptionMapConfig = createMapConfig(options);