From c6f6241605022a6b397b5ebd4ece540f83e86522 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 17 Jun 2021 19:27:18 +0530 Subject: [PATCH] linting fix --- libs/remixd/src/services/slitherClient.ts | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/libs/remixd/src/services/slitherClient.ts b/libs/remixd/src/services/slitherClient.ts index 3990eeb6ee..a9c922c566 100644 --- a/libs/remixd/src/services/slitherClient.ts +++ b/libs/remixd/src/services/slitherClient.ts @@ -1,3 +1,5 @@ +/* eslint dot-notation: "off" */ + import * as WS from 'ws' // eslint-disable-line import { PluginClient } from '@remixproject/plugin' import { existsSync, readFileSync } from 'fs' @@ -24,8 +26,8 @@ export class SlitherClient extends PluginClient { transform (detectors) { const standardReport = [] - for (let e of detectors) { - let obj = {} + for (const e of detectors) { + const obj = {} obj['description'] = e['description'] obj['title'] = e.check obj['confidence'] = e.confidence @@ -66,20 +68,10 @@ export class SlitherClient extends PluginClient { const solcArgs = optimizeOption || evmOption ? `--solc-args '${optimizeOption}${evmOption}'` : '' const cmd = `slither ${filePath} ${solcArgs} --json ${outputFile}` const child = spawn(cmd, options) - let result = '' - let error = '' - let response = {} - child.stdout.on('data', (data) => { - const msg = `[Slither Analysis]: ${data.toString()}` - console.log('\x1b[32m%s\x1b[0m', msg) - result += msg + '\n' - }) - child.stderr.on('data', (err) => { - error += `[Slither Analysis]: ${err.toString()}` - }) + const response = {} child.on('close', () => { const outputFileAbsPath = `${this.currentSharedFolder}/${outputFile}` - if (existsSync (outputFileAbsPath)) { + if (existsSync(outputFileAbsPath)) { let report = readFileSync(outputFileAbsPath, 'utf8') report = JSON.parse(report) if (report['success']) { @@ -87,7 +79,7 @@ export class SlitherClient extends PluginClient { if (!report['results'] || !report['results'].detectors || !report['results'].detectors.length) { response['count'] = 0 } else { - const { detectors } = report['results'] + const { detectors } = report['results'] response['count'] = detectors.length response['data'] = this.transform(detectors) }