From 7528d2df468736a2cfcc2a6e1b931b7a4266c675 Mon Sep 17 00:00:00 2001 From: Emanuele Libralato Date: Tue, 17 Dec 2019 23:29:33 +0100 Subject: [PATCH] fix: linter errors --- garden-service/src/analytics/analytics.ts | 18 +++++++++++------- garden-service/src/config/validation.ts | 8 ++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/garden-service/src/analytics/analytics.ts b/garden-service/src/analytics/analytics.ts index 22d12c81850..2dc3827e5d4 100644 --- a/garden-service/src/analytics/analytics.ts +++ b/garden-service/src/analytics/analytics.ts @@ -201,6 +201,16 @@ export class AnalyticsHandler { // Subscribe to the TaskGraph events this.garden.events.onAny((name, payload) => this.processEvent(name, payload)) + this.projectMetadata = await this.generateProjectMetadata() + + return this + } + + hasOptedIn(): boolean { + return this.globalConfig.optedIn || false + } + + private async generateProjectMetadata() { // Generate the project metadata const configGraph = await this.garden.getConfigGraph(this.log) const modules = await configGraph.getModules() @@ -211,19 +221,13 @@ export class AnalyticsHandler { const tests = modules.map((m) => m.testConfigs) const numberOfTests = ([] as TestConfig[]).concat(...tests).length - this.projectMetadata = { + return { numberOfModules: modules.length, modulesTypes, numberOfTasks: tasks.length, numberOfServices: services.length, numberOfTests, } - - return this - } - - hasOptedIn(): boolean { - return this.globalConfig.optedIn || false } private getBasicAnalyticsProperties(): AnalyticsEventProperties { diff --git a/garden-service/src/config/validation.ts b/garden-service/src/config/validation.ts index a4b634eb27b..4d09dd092da 100644 --- a/garden-service/src/config/validation.ts +++ b/garden-service/src/config/validation.ts @@ -1,3 +1,11 @@ +/* + * Copyright (C) 2018 Garden Technologies, Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + import Joi from "@hapi/joi" import { ConfigurationError, LocalConfigError } from "../exceptions" import chalk from "chalk"