Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: disable hovers [IDE-390] #554

Merged
merged 10 commits into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Snyk Security Changelog

## [2.20.0]
- disable hovers over issues
- If $/snyk.hasAuthenticated transmits an API URL, this is saved in the settings.
- Delete sentry reporting.

## [2.19.2]
- Update download endpoint to downloads.snyk.io.
- Send correct FixId to AI Fix endpoint.
- Hide AI Fix div if no fixes found.

## [2.19.1]
- Adjust OSS panel font size.
- Adjust OSS panel font size

## [2.19.0]
- Moved delta scan preview setting to settings page.
1,289 changes: 125 additions & 1,164 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -529,7 +529,6 @@
"mocha": "10.1.0",
"prettier": "^2.6.1",
"sass": "^1.48.0",
"sentry-testkit": "^3.3.7",
"sinon": "^11.1.1",
"ts-node": "^10.7.0",
"typescript": "^5.4.3",
@@ -542,8 +541,6 @@
"@babel/traverse": "^7.23.9",
"@babel/types": "^7.23.9",
"@deepcode/dcignore": "^1.0.4",
"@sentry/node": "^6.16.1",
"@sentry/tracing": "^6.19.7",
"axios": "^1.7.4",
"diff": "^5.2.0",
"glob": "^9.3.5",
5 changes: 3 additions & 2 deletions src/snyk/base/views/loadingBadge.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from 'vscode';
import { SNYK_VIEW_WELCOME } from '../../common/constants/views';
import { ErrorReporter } from '../../common/error/errorReporter';
import { IPendingTask, PendingTask } from '../pendingTask';
import { Logger } from '../../common/logger/logger';

export interface ILoadingBadge {
setLoadingBadge(value: boolean): void;
@@ -30,7 +30,8 @@ export class LoadingBadge implements ILoadingBadge {
.withProgress({ location: { viewId: SNYK_VIEW_WELCOME } }, () => self.getProgressBadgePromise())
.then(
() => undefined,
error => ErrorReporter.capture(error),
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
error => Logger.error(error),
);
} else if (this.progressBadge && !this.progressBadge.isCompleted) {
this.progressBadge.complete();
4 changes: 1 addition & 3 deletions src/snyk/common/error/errorHandler.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
import { SNYK_CONTEXT } from '../constants/views';
import { ILog } from '../logger/interfaces';
import { IContextService } from '../services/contextService';
import { ErrorReporter, Tags } from './errorReporter';

/**
* General error handler.
@@ -12,7 +11,7 @@
* Should be used only if the affected error breaks the whole extension.
*/
static async handleGlobal(
error: Error | unknown,

Check warning on line 14 in src/snyk/common/error/errorHandler.ts

GitHub Actions / Build and Test (ubuntu-latest)

'unknown' overrides all other types in this union type

Check warning on line 14 in src/snyk/common/error/errorHandler.ts

GitHub Actions / Build and Test (macos-latest)

'unknown' overrides all other types in this union type

Check warning on line 14 in src/snyk/common/error/errorHandler.ts

GitHub Actions / Build and Test (windows-latest)

'unknown' overrides all other types in this union type
logger: ILog,
contextService: IContextService,
loadingBadge: ILoadingBadge,
@@ -25,13 +24,12 @@
/**
* Should be used to log locally and report error event remotely.
*/
static handle(error: Error | unknown, logger: ILog, message?: string, tags?: Tags): void {
static handle(error: Error | unknown, logger: ILog, message?: string): void {

Check warning on line 27 in src/snyk/common/error/errorHandler.ts

GitHub Actions / Build and Test (ubuntu-latest)

'unknown' overrides all other types in this union type

Check warning on line 27 in src/snyk/common/error/errorHandler.ts

GitHub Actions / Build and Test (macos-latest)

'unknown' overrides all other types in this union type

Check warning on line 27 in src/snyk/common/error/errorHandler.ts

GitHub Actions / Build and Test (windows-latest)

'unknown' overrides all other types in this union type
const errorStr = ErrorHandler.stringifyError(error);
logger.error(message ? `${message}. ${errorStr}` : errorStr);
ErrorReporter.capture(error, tags);
}

static stringifyError(error: Error | unknown): string {

Check warning on line 32 in src/snyk/common/error/errorHandler.ts

GitHub Actions / Build and Test (ubuntu-latest)

'unknown' overrides all other types in this union type

Check warning on line 32 in src/snyk/common/error/errorHandler.ts

GitHub Actions / Build and Test (macos-latest)

'unknown' overrides all other types in this union type

Check warning on line 32 in src/snyk/common/error/errorHandler.ts

GitHub Actions / Build and Test (windows-latest)

'unknown' overrides all other types in this union type
return JSON.stringify(error, Object.getOwnPropertyNames(error));
}
}
128 changes: 0 additions & 128 deletions src/snyk/common/error/errorReporter.ts

This file was deleted.

75 changes: 0 additions & 75 deletions src/snyk/common/error/integrations/onUncaughtException.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/snyk/common/languageServer/settings.ts
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ export type ServerSettings = {
enableDeltaFindings?: string;
folderConfigs: FolderConfig[];
enableSnykOSSQuickFixCodeActions: string;
hoverVerbosity: number;
};

export class LanguageServerSettings {
@@ -86,6 +87,7 @@ export class LanguageServerSettings {
requiredProtocolVersion: `${PROTOCOL_VERSION}`,
folderConfigs: configuration.getFolderConfigs(),
enableSnykOSSQuickFixCodeActions: `${configuration.getPreviewFeatures().ossQuickfixes}`,
hoverVerbosity: 0,
};
}
}
2 changes: 1 addition & 1 deletion src/snyk/common/services/learnService.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ export class LearnService {
const ecosystem = ruleSplit[0];
const additionalData = issue.additionalData;
let cwe = '';
if (additionalData.cwe.length > 0) {
if (additionalData?.cwe?.length) {
cwe = additionalData.cwe[0];
}

2 changes: 0 additions & 2 deletions src/snyk/common/user.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import * as crypto from 'crypto';
import { v4 as uuidv4 } from 'uuid';
import { SNYK_GET_ACTIVE_USER } from './constants/commands';
import { MEMENTO_ANONYMOUS_ID } from './constants/globalState';
import { ErrorReporter } from './error/errorReporter';
import { IVSCodeCommands } from './vscode/commands';
import { ExtensionContext } from './vscode/extensionContext';
import { ILog } from './logger/interfaces';
@@ -50,7 +49,6 @@ export class User {
const user = await this.userMe(commandExecutor);
if (user && user.id) {
this._authenticatedId = user.id;
ErrorReporter.identify(this);
}
}

11 changes: 3 additions & 8 deletions src/snyk/extension.ts
Original file line number Diff line number Diff line change
@@ -38,7 +38,6 @@
SNYK_VIEW_WELCOME,
} from './common/constants/views';
import { ErrorHandler } from './common/error/errorHandler';
import { ErrorReporter } from './common/error/errorReporter';
import { ExperimentService } from './common/experiment/services/experimentService';
import { LanguageServer } from './common/languageServer/languageServer';
import { StaticLsApi } from './common/languageServer/staticLsApi';
@@ -49,7 +48,7 @@
import { User } from './common/user';
import { CodeActionAdapter } from './common/vscode/codeAction';
import { vsCodeCommands } from './common/vscode/commands';
import { vsCodeEnv } from './common/vscode/env';

Check warning on line 51 in src/snyk/extension.ts

GitHub Actions / Build and Test (ubuntu-latest)

'vsCodeEnv' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 51 in src/snyk/extension.ts

GitHub Actions / Build and Test (macos-latest)

'vsCodeEnv' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 51 in src/snyk/extension.ts

GitHub Actions / Build and Test (windows-latest)

'vsCodeEnv' is defined but never used. Allowed unused vars must match /^_/u
import { extensionContext } from './common/vscode/extensionContext';
import { LanguageClientAdapter } from './common/vscode/languageClient';
import { vsCodeLanguages } from './common/vscode/languages';
@@ -89,9 +88,6 @@
this.context = extensionContext;

const snykConfiguration = await this.getSnykConfiguration();
if (snykConfiguration) {
await ErrorReporter.init(configuration, snykConfiguration, extensionContext.extensionPath, vsCodeEnv, Logger);
}

try {
await this.initializeExtension(vscodeContext, snykConfiguration);
@@ -120,7 +116,7 @@
const previousBranches = new Map<Repository, string | undefined>();
// Register event listener for changes in each repository
repositories.forEach((repo: Repository) => {
let previousBranch = repo.state.HEAD?.name;
const previousBranch = repo.state.HEAD?.name;
previousBranches.set(repo, previousBranch);
repo.state.onDidChange(async () => {
const currentBranch = repo.state.HEAD?.name;
@@ -396,8 +392,8 @@

// noinspection ES6MissingAwait
void this.notificationService.init();

this.checkAdvancedMode().catch(err => ErrorReporter.capture(err));
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
this.checkAdvancedMode().catch(err => Logger.error(err));

this.experimentService.load();

@@ -440,7 +436,6 @@
public async deactivate(): Promise<void> {
this.ossVulnerabilityCountService.dispose();
await this.languageServer.stop();
await ErrorReporter.flush();
}

public async restartLanguageServer(): Promise<void> {
70 changes: 0 additions & 70 deletions src/test/unit/common/error/errorReporter.test.ts

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -234,6 +234,7 @@ suite('Language Server', () => {
folderConfigs: [],
authenticationMethod: 'oauth',
enableSnykOSSQuickFixCodeActions: 'false',
hoverVerbosity: 0,
};

deepStrictEqual(await languageServer.getInitializationOptions(), expectedInitializationOptions);
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"ignoreDeprecations": "5.0",
"noUnusedParameters": true,
"esModuleInterop": true,

Unchanged files with check annotations Beta

export class CliError {
constructor(public error: string | Error | unknown, public path?: string, public isCancellation = false) {}

Check warning on line 2 in src/snyk/cli/services/cliService.ts

GitHub Actions / Build and Test (ubuntu-latest)

'unknown' overrides all other types in this union type

Check warning on line 2 in src/snyk/cli/services/cliService.ts

GitHub Actions / Build and Test (macos-latest)

'unknown' overrides all other types in this union type

Check warning on line 2 in src/snyk/cli/services/cliService.ts

GitHub Actions / Build and Test (windows-latest)

'unknown' overrides all other types in this union type
}
import _, { flatten } from 'lodash';
import * as vscode from 'vscode'; // todo: invert dependency
import { IConfiguration, IssueViewOptions } from '../../common/configuration/configuration';
import { Issue, IssueSeverity, ScanProduct, LsErrorMessage } from '../../common/languageServer/types';

Check warning on line 4 in src/snyk/common/views/issueTreeProvider.ts

GitHub Actions / Build and Test (ubuntu-latest)

'ScanProduct' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 4 in src/snyk/common/views/issueTreeProvider.ts

GitHub Actions / Build and Test (macos-latest)

'ScanProduct' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 4 in src/snyk/common/views/issueTreeProvider.ts

GitHub Actions / Build and Test (windows-latest)

'ScanProduct' is defined but never used. Allowed unused vars must match /^_/u
import { messages as commonMessages } from '../../common/messages/analysisMessages';
import { IContextService } from '../../common/services/contextService';
import { IProductService, ProductService } from '../../common/services/productService';

Check warning on line 7 in src/snyk/common/views/issueTreeProvider.ts

GitHub Actions / Build and Test (ubuntu-latest)

'ProductService' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 7 in src/snyk/common/views/issueTreeProvider.ts

GitHub Actions / Build and Test (macos-latest)

'ProductService' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 7 in src/snyk/common/views/issueTreeProvider.ts

GitHub Actions / Build and Test (windows-latest)

'ProductService' is defined but never used. Allowed unused vars must match /^_/u
import { AnalysisTreeNodeProvider } from '../../common/views/analysisTreeNodeProvider';
import { INodeIcon, InternalType, NODE_ICONS, TreeNode } from '../../common/views/treeNode';
import { IVSCodeLanguages } from '../../common/vscode/languages';
const folderName = shortFolderPath.pop() || uri.path;
let folderVulnCount = 0;
if (folderResult instanceof Error && folderResult.message === LsErrorMessage.repositoryInvalidError) {

Check warning on line 212 in src/snyk/common/views/issueTreeProvider.ts

GitHub Actions / Build and Test (ubuntu-latest)

The two values in this comparison do not have a shared enum type

Check warning on line 212 in src/snyk/common/views/issueTreeProvider.ts

GitHub Actions / Build and Test (macos-latest)

The two values in this comparison do not have a shared enum type

Check warning on line 212 in src/snyk/common/views/issueTreeProvider.ts

GitHub Actions / Build and Test (windows-latest)

The two values in this comparison do not have a shared enum type
nodes.push(this.getFaultyRepositoryErrorTreeNode(folderName, folderResult.toString()));
continue;
}
updateConfiguration(
configurationIdentifier: string,
section: string,
value: any,

Check warning on line 12 in src/snyk/common/vscode/workspace.ts

GitHub Actions / Build and Test (ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 12 in src/snyk/common/vscode/workspace.ts

GitHub Actions / Build and Test (macos-latest)

Unexpected any. Specify a different type

Check warning on line 12 in src/snyk/common/vscode/workspace.ts

GitHub Actions / Build and Test (windows-latest)

Unexpected any. Specify a different type
configurationTarget?: boolean,
overrideInLanguage?: boolean,
): Promise<void>;
updateConfiguration(
configurationIdentifier: string,
section: string,
value: any,

Check warning on line 35 in src/snyk/common/vscode/workspace.ts

GitHub Actions / Build and Test (ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 35 in src/snyk/common/vscode/workspace.ts

GitHub Actions / Build and Test (macos-latest)

Unexpected any. Specify a different type

Check warning on line 35 in src/snyk/common/vscode/workspace.ts

GitHub Actions / Build and Test (windows-latest)

Unexpected any. Specify a different type
configurationTarget?: boolean,
overrideInLanguage?: boolean,
): Promise<void> {