Skip to content

Commit

Permalink
chore: fix sonar gate
Browse files Browse the repository at this point in the history
Signed-off-by: Iliya Savov <[email protected]>
  • Loading branch information
isavov committed Jan 4, 2024
1 parent d294869 commit fddf2ea
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/services/CLIService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class CLIService implements IService{
const verbose = CLIService.resolveVerboseLevel(argv.verbose as string);
const timestamp = argv.timestamp as string;
const enableDebug = argv.enableDebug as boolean;
const workDir: string = FileSystemUtils.parseWorkDir(argv.workdir) as string;
const workDir = FileSystemUtils.parseWorkDir(argv.workdir) as string;

const currentArgv: CLIOptions = {
accounts,
Expand Down
3 changes: 1 addition & 2 deletions src/state/CleanUpState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
*
*/

import { readFileSync, writeFileSync } from 'fs';
import { readFileSync, writeFileSync, existsSync } from 'fs';
import yaml from 'js-yaml';
import { join } from 'path';
import { existsSync } from 'fs';
import { IOBserver } from '../controller/IObserver';
import originalNodeConfiguration from '../configuration/originalNodeConfiguration.json';
import { LoggerService } from '../services/LoggerService';
Expand Down
2 changes: 1 addition & 1 deletion src/state/InitState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ServiceLocator } from '../services/ServiceLocator';
import { IState } from './IState';
import { CLIService } from '../services/CLIService';
import { CLIOptions } from '../types/CLIOptions';
import { FileSystemUtils } from '../utils/FileSystemUtils'
import { FileSystemUtils } from '../utils/FileSystemUtils';
import { IOBserver } from '../controller/IObserver';
import { EventType } from '../types/EventType';
import { ConfigurationData } from '../data/ConfigurationData';
Expand Down
15 changes: 8 additions & 7 deletions src/utils/FileSystemUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class FileSystemUtils{

Object.entries(directories).forEach(([srcPath, destPath]) => {
if (!existsSync(srcPath)) {
logger.error(`Path ${srcPath} doesn't exist`, FileSystemUtils.name)
logger.error(`Path ${srcPath} doesn't exist`, FileSystemUtils.name);
return;
}

Expand Down Expand Up @@ -54,16 +54,17 @@ export class FileSystemUtils{
join(workDir, 'network-logs', 'node', 'stats'),
];

directories.forEach(dir => FileSystemUtils.ensureDirectoryExists(dir)); //creating those directories ensures we'll have permissions to delete them on cleanup
directories.forEach(dir => FileSystemUtils.ensureDirectoryExists(dir)); // creating those directories ensures we'll have permissions to delete them on cleanup
}

public static parseWorkDir(workdir: any): string {
if (workdir.startsWith('~')) {
workdir = join(homedir(), workdir.slice(1));
let workdirPath = workdir;
if (workdirPath.startsWith('~')) {
workdirPath = join(homedir(), workdirPath.slice(1));
}
if (workdir !== this.getPlatformSpecificAppDataPath('hedera-local')) {
workdir = join(workdir, 'hedera-local');
if (workdirPath !== this.getPlatformSpecificAppDataPath('hedera-local')) {
workdirPath = join(workdirPath, 'hedera-local');
}
return resolve(workdir);
return resolve(workdirPath);
}
}

0 comments on commit fddf2ea

Please sign in to comment.