Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawkyZ committed Dec 9, 2024
1 parent 583ad61 commit fe126ef
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/snyk/cli/cliExecutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class CliExecutable {
windows_arm64: 'snyk-win.exe',
};

constructor(public readonly version: string, public readonly checksum: Checksum) { }
constructor(public readonly version: string, public readonly checksum: Checksum) {}

static async getPath(customPath?: string): Promise<string> {
if (customPath) {
Expand Down
4 changes: 2 additions & 2 deletions src/snyk/common/download/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Downloader {
private readonly window: IVSCodeWindow,
private readonly logger: ILog,
private readonly extensionContext: ExtensionContext,
) { }
) {}
/**
* Downloads CLI. Existing executable is deleted.
*/
Expand All @@ -46,7 +46,7 @@ export class Downloader {

private async getCliExecutable(platform: CliSupportedPlatform): Promise<CliExecutable | null> {
const cliPath = await this.configuration.getCliPath();
const cliDir = path.dirname(cliPath);;
const cliDir = path.dirname(cliPath);
mkdirSync(cliDir, { recursive: true });
if (await this.binaryExists(cliPath)) {
await this.deleteFileAtPath(cliPath);
Expand Down
5 changes: 1 addition & 4 deletions src/snyk/common/languageServer/languageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ export class LanguageServer implements ILanguageServer {
// Initialization options are not semantically equal to server settings, thus separated here
// https://github.com/microsoft/language-server-protocol/issues/567
async getInitializationOptions(): Promise<ServerSettings> {
const settings = await LanguageServerSettings.fromConfiguration(
this.configuration,
this.user,
);
const settings = await LanguageServerSettings.fromConfiguration(this.configuration, this.user);
return settings;
}

Expand Down
7 changes: 2 additions & 5 deletions src/snyk/common/languageServer/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type LanguageClientWorkspaceMiddleware = Partial<WorkspaceMiddleware> & {
};

export class LanguageClientMiddleware implements Middleware {
constructor(private configuration: IConfiguration, private user: User, private extensionContext: ExtensionContext) { }
constructor(private configuration: IConfiguration, private user: User, private extensionContext: ExtensionContext) {}

workspace: LanguageClientWorkspaceMiddleware = {
configuration: async (
Expand All @@ -41,10 +41,7 @@ export class LanguageClientMiddleware implements Middleware {
return [];
}

const serverSettings = await LanguageServerSettings.fromConfiguration(
this.configuration,
this.user,
);
const serverSettings = await LanguageServerSettings.fromConfiguration(this.configuration, this.user);
return [serverSettings];
},
};
Expand Down
5 changes: 1 addition & 4 deletions src/snyk/common/languageServer/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ export type ServerSettings = {
};

export class LanguageServerSettings {
static async fromConfiguration(
configuration: IConfiguration,
user: User,
): Promise<ServerSettings> {
static async fromConfiguration(configuration: IConfiguration, user: User): Promise<ServerSettings> {
const featuresConfiguration = configuration.getFeaturesConfiguration();

const ossEnabled = _.isUndefined(featuresConfiguration.ossEnabled) ? true : featuresConfiguration.ossEnabled;
Expand Down
5 changes: 2 additions & 3 deletions src/snyk/common/services/downloadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ export class DownloadService {
}

async isCliInstalled() {
const cliExecutableExists = await CliExecutable.exists(
this.extensionContext.extensionPath,
);
const cliExecutableExists = await CliExecutable.exists(this.extensionContext.extensionPath);
const cliChecksumWritten = !!this.getCliChecksum();

return cliExecutableExists && cliChecksumWritten;
Expand All @@ -111,6 +109,7 @@ export class DownloadService {
try {
await fsPromises.unlink(path);
} catch {
// eslint-disable-next-line no-empty
}
await this.configuration.setCliPath(await CliExecutable.getPath());
return true;
Expand Down
5 changes: 1 addition & 4 deletions src/test/unit/common/languageServer/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ suite('Language Server: Middleware', () => {
serverResult.manageBinariesAutomatically,
`${configuration.isAutomaticDependencyManagementEnabled()}`,
);
assert.strictEqual(
serverResult.cliPath,
await configuration.getCliPath(),
);
assert.strictEqual(serverResult.cliPath, await configuration.getCliPath());
assert.strictEqual(serverResult.enableTrustedFoldersFeature, 'true');
assert.deepStrictEqual(serverResult.trustedFolders, configuration.getTrustedFolders());
});
Expand Down
5 changes: 1 addition & 4 deletions src/test/unit/common/languageServer/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ suite('LanguageServerSettings', () => {
scanningMode: 'scan-mode',
} as unknown as IConfiguration;

const serverSettings = await LanguageServerSettings.fromConfiguration(
mockConfiguration,
mockUser,
);
const serverSettings = await LanguageServerSettings.fromConfiguration(mockConfiguration, mockUser);

assert.strictEqual(serverSettings.activateSnykCodeSecurity, 'true');
assert.strictEqual(serverSettings.activateSnykCodeQuality, 'true');
Expand Down

0 comments on commit fe126ef

Please sign in to comment.