From bd992450e77ae101a5d841b6304a72d918aa465d Mon Sep 17 00:00:00 2001 From: AayushSaini101 Date: Tue, 10 Dec 2024 12:32:03 +0530 Subject: [PATCH] Remove sonar issue --- src/commands/config/proxy.ts | 14 +++++++------- src/core/flags/config/proxy.flags.ts | 2 +- test/integration/config/proxy.test.ts | 0 3 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 test/integration/config/proxy.test.ts diff --git a/src/commands/config/proxy.ts b/src/commands/config/proxy.ts index a49a1ff047a..62aa3fcbb10 100644 --- a/src/commands/config/proxy.ts +++ b/src/commands/config/proxy.ts @@ -2,9 +2,9 @@ import Command from '../../core/base'; import {proxyFlags} from '../../core/flags/config/proxy.flags'; export default class Proxy extends Command { - static description = 'Add the proxy support in the CLI.'; + static readonly description = 'Add the proxy support in the CLI.'; - static flags = proxyFlags(); + static readonly flags = proxyFlags(); async run() { const { flags } = await this.parse(Proxy); //NOSONAR @@ -17,23 +17,23 @@ export default class Proxy extends Command { if (http_proxy) { process.env.http_proxy = http_proxy; this.log( - 'http_proxy has been succesfully added in the CLI} ✅', + 'http_proxy has been succesfully added in the CLI✅', ); } if (https_proxy) { process.env.https_proxy = https_proxy; this.log( - 'https_proxy has been succesfully added in the CLI} ✅', + 'https_proxy has been succesfully added in the CLI✅', ); } - + this.log(`http_proxy: ${process.env.http_proxy}`); + this.log(`https_proxy: ${process.env.https_proxy}`); // Removing all proxies if `--no_proxy` is provided if (no_proxy) { delete process.env.http_proxy; delete process.env.https_proxy; - this.log( - 'All the proxies has been removed from the CLI } ✅', + 'All the proxies has been removed from the CLI ✅', ); } } diff --git a/src/core/flags/config/proxy.flags.ts b/src/core/flags/config/proxy.flags.ts index 3bbac3b5cd3..6b8a70eca75 100644 --- a/src/core/flags/config/proxy.flags.ts +++ b/src/core/flags/config/proxy.flags.ts @@ -5,7 +5,7 @@ export const proxyFlags = () => { help: Flags.help({ char: 'h' }), http_proxy: Flags.string({ string: 'http_proxy', description: 'add http_proxy', default: '' }), https_proxy: Flags.string({ string: 'https_proxy', description: 'add https_proxy', default: '' }), - no_proxy: Flags.string({ string: 'no_proxy', description: 'remove all the proxies from the env' }), + no_proxy: Flags.boolean({ description: 'Remove all the proxies from the environment', default: false }), }; }; diff --git a/test/integration/config/proxy.test.ts b/test/integration/config/proxy.test.ts new file mode 100644 index 00000000000..e69de29bb2d