Skip to content

Commit

Permalink
refactor: duplicate snyk oss folder for new LS; rename snykOss folder…
Browse files Browse the repository at this point in the history
… to snykOssOld
  • Loading branch information
j-luong committed Oct 23, 2023
1 parent 185b605 commit 78a8100
Show file tree
Hide file tree
Showing 40 changed files with 62 additions and 62 deletions.
4 changes: 2 additions & 2 deletions src/snyk/base/modules/baseSnykModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import { IMarkdownStringAdapter, MarkdownStringAdapter } from '../../common/vsco
import { IWatcher } from '../../common/watchers/interfaces';
import { ICodeSettings } from '../../snykCode/codeSettings';
import SnykEditorsWatcher from '../../snykCode/watchers/editorsWatcher';
import { OssService } from '../../snykOss/services/ossService';
import { OssVulnerabilityCountService } from '../../snykOss/services/vulnerabilityCount/ossVulnerabilityCountService';
import { OssService } from '../../snykOssOld/services/ossService';
import { OssVulnerabilityCountService } from '../../snykOssOld/services/vulnerabilityCount/ossVulnerabilityCountService';
import { IAuthenticationService } from '../services/authenticationService';
import { ScanModeService } from '../services/scanModeService';
import SnykStatusBarItem, { IStatusBarItem } from '../statusBarItem/statusBarItem';
Expand Down
10 changes: 5 additions & 5 deletions src/snyk/common/commands/commandController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import { createDCIgnore } from '../../snykCode/utils/ignoreFileUtils';
import { IssueUtils } from '../../snykCode/utils/issueUtils';
import { CodeIssueCommandArg } from '../../snykCode/views/interfaces';
import { IacIssueCommandArg } from '../../snykIac/views/interfaces';
import { capitalizeOssSeverity } from '../../snykOss/ossResult';
import { OssService } from '../../snykOss/services/ossService';
import { OssIssueCommandArg } from '../../snykOss/views/ossVulnerabilityTreeProvider';
import { capitalizeOssSeverity } from '../../snykOssOld/ossResult';
import { OssService } from '../../snykOssOld/services/ossService';
import { OssIssueCommandArg } from '../../snykOssOld/views/ossVulnerabilityTreeProvider';
import { IAnalytics } from '../analytics/itly';
import {
SNYK_INITIATE_LOGIN_COMMAND,
SNYK_LOGIN_COMMAND,
SNYK_OPEN_BROWSER_COMMAND,
SNYK_SET_TOKEN_COMMAND,
SNYK_TRUST_WORKSPACE_FOLDERS_COMMAND,
VSCODE_GO_TO_SETTINGS_COMMAND,
VSCODE_GO_TO_SETTINGS_COMMAND

Check failure on line 19 in src/snyk/common/commands/commandController.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Insert `,`
} from '../constants/commands';
import { COMMAND_DEBOUNCE_INTERVAL, IDE_NAME, SNYK_NAME_EXTENSION, SNYK_PUBLISHER } from '../constants/general';
import { ErrorHandler } from '../error/errorHandler';
Expand Down Expand Up @@ -48,7 +48,7 @@ export class CommandController {
private languageServer: ILanguageServer,
private logger: ILog,
private analytics: IAnalytics,
) {}
) { }

Check failure on line 51 in src/snyk/common/commands/commandController.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Delete `·`

openBrowser(url: string): unknown {
return this.executeCommand(SNYK_OPEN_BROWSER_COMMAND, this.openerService.openBrowserUrl.bind(this), url);
Expand Down
2 changes: 1 addition & 1 deletion src/snyk/common/commands/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { completeFileSuggestionType } from '../../snykCode/interfaces';
import { CodeIssueCommandArg } from '../../snykCode/views/interfaces';
import { IacIssueCommandArg } from '../../snykIac/views/interfaces';
import { OssIssueCommandArg } from '../../snykOss/views/ossVulnerabilityTreeProvider';
import { OssIssueCommandArg } from '../../snykOssOld/views/ossVulnerabilityTreeProvider';
import { CodeIssueData, Issue } from '../languageServer/types';

export enum OpenCommandIssueType {
Expand Down
4 changes: 2 additions & 2 deletions src/snyk/common/services/learnService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OssIssueCommandArg } from '../../snykOss/views/ossVulnerabilityTreeProvider';
import { OssIssueCommandArg } from '../../snykOssOld/views/ossVulnerabilityTreeProvider';
import { SNYK_GET_LESSON_COMMAND } from '../constants/commands';
import { CodeIssueData, Issue } from '../languageServer/types';
import { IVSCodeCommands } from '../vscode/commands';
Expand All @@ -9,7 +9,7 @@ export type Lesson = {
};

export class LearnService {
constructor(private commandExecutor: IVSCodeCommands) {}
constructor(private commandExecutor: IVSCodeCommands) { }

Check failure on line 12 in src/snyk/common/services/learnService.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Delete `·`

async getOssLesson(vulnerability: OssIssueCommandArg): Promise<Lesson | undefined> {
const cwe = vulnerability.identifiers?.CWE;
Expand Down
8 changes: 4 additions & 4 deletions src/snyk/common/services/moduleParserProvider.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BabelParser } from '../../snykOss/services/vulnerabilityCount/parsers/babelParser';
import { HtmlParser } from '../../snykOss/services/vulnerabilityCount/parsers/htmlParser';
import { ModuleParser } from '../../snykOss/services/vulnerabilityCount/parsers/moduleParser';
import { PackageJsonParser } from '../../snykOss/services/vulnerabilityCount/parsers/packageJsonParser';
import { BabelParser } from '../../snykOssOld/services/vulnerabilityCount/parsers/babelParser';
import { HtmlParser } from '../../snykOssOld/services/vulnerabilityCount/parsers/htmlParser';
import { ModuleParser } from '../../snykOssOld/services/vulnerabilityCount/parsers/moduleParser';
import { PackageJsonParser } from '../../snykOssOld/services/vulnerabilityCount/parsers/packageJsonParser';
import { IConfiguration } from '../configuration/configuration';
import { ILog } from '../logger/interfaces';
import { Language } from '../types';
Expand Down
26 changes: 13 additions & 13 deletions src/snyk/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ import { CodeSuggestionWebviewProvider } from './snykCode/views/suggestion/codeS
import { IacService } from './snykIac/iacService';
import IacIssueTreeProvider from './snykIac/views/iacIssueTreeProvider';
import { IacSuggestionWebviewProvider } from './snykIac/views/suggestion/iacSuggestionWebviewProvider';
import { EditorDecorator } from './snykOss/editor/editorDecorator';
import { OssService } from './snykOss/services/ossService';
import { OssVulnerabilityCountService } from './snykOss/services/vulnerabilityCount/ossVulnerabilityCountService';
import { ModuleVulnerabilityCountProvider } from './snykOss/services/vulnerabilityCount/vulnerabilityCountProvider';
import { OssVulnerabilityTreeProvider } from './snykOss/views/ossVulnerabilityTreeProvider';
import { OssSuggestionWebviewProvider } from './snykOss/views/suggestion/ossSuggestionWebviewProvider';
import { DailyScanJob } from './snykOss/watchers/dailyScanJob';
import { EditorDecorator } from './snykOssOld/editor/editorDecorator';
import { OssService } from './snykOssOld/services/ossService';
import { OssVulnerabilityCountService } from './snykOssOld/services/vulnerabilityCount/ossVulnerabilityCountService';
import { ModuleVulnerabilityCountProvider } from './snykOssOld/services/vulnerabilityCount/vulnerabilityCountProvider';
import { OssVulnerabilityTreeProvider } from './snykOssOld/views/ossVulnerabilityTreeProvider';
import { OssSuggestionWebviewProvider } from './snykOssOld/views/suggestion/ossSuggestionWebviewProvider';
import { DailyScanJob } from './snykOssOld/watchers/dailyScanJob';

class SnykExtension extends SnykLib implements IExtension {
public async activate(vscodeContext: vscode.ExtensionContext): Promise<void> {
Expand Down Expand Up @@ -263,12 +263,12 @@ class SnykExtension extends SnykLib implements IExtension {
this.registerCommands(vscodeContext);

const codeSecurityIssueProvider = new CodeSecurityIssueTreeProvider(
this.viewManagerService,
this.contextService,
this.snykCode,
configuration,
vsCodeLanguages,
),
this.viewManagerService,

Check failure on line 266 in src/snyk/extension.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Insert `··`
this.contextService,

Check failure on line 267 in src/snyk/extension.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Insert `··`
this.snykCode,

Check failure on line 268 in src/snyk/extension.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Insert `··`
configuration,

Check failure on line 269 in src/snyk/extension.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Insert `··`
vsCodeLanguages,

Check failure on line 270 in src/snyk/extension.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Insert `··`
),

Check failure on line 271 in src/snyk/extension.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Insert `··`
codeQualityIssueProvider = new CodeQualityIssueTreeProvider(
this.viewManagerService,
this.contextService,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/test/unit/common/commands/commandController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { ScanModeService } from '../../../../snyk/base/services/scanModeService'
import { IAnalytics } from '../../../../snyk/common/analytics/itly';
import { CommandController } from '../../../../snyk/common/commands/commandController';
import { COMMAND_DEBOUNCE_INTERVAL } from '../../../../snyk/common/constants/general';
import { CodeIssueData, IacIssueData } from '../../../../snyk/common/languageServer/types';
import { IOpenerService } from '../../../../snyk/common/services/openerService';
import { IProductService } from '../../../../snyk/common/services/productService';
import { IVSCodeCommands } from '../../../../snyk/common/vscode/commands';
import { IVSCodeWorkspace } from '../../../../snyk/common/vscode/workspace';
import { OssService } from '../../../../snyk/snykOss/services/ossService';
import { OssService } from '../../../../snyk/snykOssOld/services/ossService';
import { LanguageServerMock } from '../../mocks/languageServer.mock';
import { LoggerMock } from '../../mocks/logger.mock';
import { windowMock } from '../../mocks/window.mock';
import { IProductService } from '../../../../snyk/common/services/productService';
import { CodeIssueData, IacIssueData } from '../../../../snyk/common/languageServer/types';

suite('CommandController', () => {
const sleep = util.promisify(setTimeout);
Expand Down
8 changes: 4 additions & 4 deletions src/test/unit/common/services/learnService.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { strictEqual } from 'assert';
import sinon from 'sinon';
import { IVSCodeCommands } from '../../../../snyk/common/vscode/commands';
import { LearnService } from '../../../../snyk/common/services/learnService';
import { OssIssueCommandArg } from '../../../../snyk/snykOss/views/ossVulnerabilityTreeProvider';
import { CodeIssueData, Issue, IssueSeverity } from '../../../../snyk/common/languageServer/types';
import { SNYK_GET_LESSON_COMMAND } from '../../../../snyk/common/constants/commands';
import { CodeIssueData, Issue, IssueSeverity } from '../../../../snyk/common/languageServer/types';
import { LearnService } from '../../../../snyk/common/services/learnService';
import { IVSCodeCommands } from '../../../../snyk/common/vscode/commands';
import { OssIssueCommandArg } from '../../../../snyk/snykOssOld/views/ossVulnerabilityTreeProvider';

suite('LearnService', () => {
let commands: IVSCodeCommands;
Expand Down
4 changes: 2 additions & 2 deletions src/test/unit/snykOss/editor/editorDecorator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import sinon from 'sinon';
import { IVSCodeLanguages } from '../../../../snyk/common/vscode/languages';
import { IThemeColorAdapter } from '../../../../snyk/common/vscode/theme';
import { IVSCodeWindow } from '../../../../snyk/common/vscode/window';
import { EditorDecorator } from '../../../../snyk/snykOss/editor/editorDecorator';
import { ModuleVulnerabilityCount } from '../../../../snyk/snykOss/services/vulnerabilityCount/importedModule';
import { EditorDecorator } from '../../../../snyk/snykOssOld/editor/editorDecorator';
import { ModuleVulnerabilityCount } from '../../../../snyk/snykOssOld/services/vulnerabilityCount/importedModule';

suite('OSS Editor Decorator', () => {
let decorator: EditorDecorator;
Expand Down
8 changes: 4 additions & 4 deletions src/test/unit/snykOss/services/ossService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { IViewManagerService } from '../../../../snyk/common/services/viewManage
import { IWebViewProvider } from '../../../../snyk/common/views/webviewProvider';
import { ExtensionContext } from '../../../../snyk/common/vscode/extensionContext';
import { IVSCodeWorkspace } from '../../../../snyk/common/vscode/workspace';
import { OssFileResult, OssResult, OssSeverity } from '../../../../snyk/snykOss/ossResult';
import { OssService } from '../../../../snyk/snykOss/services/ossService';
import { OssIssueCommandArg } from '../../../../snyk/snykOss/views/ossVulnerabilityTreeProvider';
import { DailyScanJob } from '../../../../snyk/snykOss/watchers/dailyScanJob';
import { OssFileResult, OssResult, OssSeverity } from '../../../../snyk/snykOssOld/ossResult';
import { OssService } from '../../../../snyk/snykOssOld/services/ossService';
import { OssIssueCommandArg } from '../../../../snyk/snykOssOld/views/ossVulnerabilityTreeProvider';
import { DailyScanJob } from '../../../../snyk/snykOssOld/watchers/dailyScanJob';
import { LanguageServerMock } from '../../mocks/languageServer.mock';
import { LoggerMock } from '../../mocks/logger.mock';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import sinon from 'sinon';
import { IAnalytics } from '../../../../../snyk/common/analytics/itly';
import { IConfiguration } from '../../../../../snyk/common/configuration/configuration';
import { ICodeActionKindAdapter } from '../../../../../snyk/common/vscode/codeAction';
import { ILanguageClientAdapter } from '../../../../../snyk/common/vscode/languageClient';
import { IVSCodeLanguages } from '../../../../../snyk/common/vscode/languages';
import { ITextDocumentAdapter } from '../../../../../snyk/common/vscode/textdocument';
import { IThemeColorAdapter } from '../../../../../snyk/common/vscode/theme';
import { TextDocument, TextEditor } from '../../../../../snyk/common/vscode/types';
import { IUriAdapter } from '../../../../../snyk/common/vscode/uri';
import { IVSCodeWindow } from '../../../../../snyk/common/vscode/window';
import { IVSCodeWorkspace } from '../../../../../snyk/common/vscode/workspace';
import { EditorDecorator } from '../../../../../snyk/snykOss/editor/editorDecorator';
import { OssFileResult } from '../../../../../snyk/snykOss/ossResult';
import { OssService } from '../../../../../snyk/snykOss/services/ossService';
import { OssVulnerabilityCountService } from '../../../../../snyk/snykOss/services/vulnerabilityCount/ossVulnerabilityCountService';
import { ModuleVulnerabilityCountProvider } from '../../../../../snyk/snykOss/services/vulnerabilityCount/vulnerabilityCountProvider';
import { EditorDecorator } from '../../../../../snyk/snykOssOld/editor/editorDecorator';
import { OssFileResult } from '../../../../../snyk/snykOssOld/ossResult';
import { OssService } from '../../../../../snyk/snykOssOld/services/ossService';
import { OssVulnerabilityCountService } from '../../../../../snyk/snykOssOld/services/vulnerabilityCount/ossVulnerabilityCountService';
import { ModuleVulnerabilityCountProvider } from '../../../../../snyk/snykOssOld/services/vulnerabilityCount/vulnerabilityCountProvider';
import { LoggerMock } from '../../../mocks/logger.mock';
import { ILanguageClientAdapter } from '../../../../../snyk/common/vscode/languageClient';
import { IUriAdapter } from '../../../../../snyk/common/vscode/uri';
import { ITextDocumentAdapter } from '../../../../../snyk/common/vscode/textdocument';

suite('OSS VulnerabilityCountService', () => {
let workspace: IVSCodeWorkspace;
Expand Down Expand Up @@ -99,9 +99,9 @@ suite('OSS VulnerabilityCountService', () => {

test('Processes file if active editor is opened on activation', () => {
window.getActiveTextEditor = () =>
({
document: undefined,
} as unknown as TextEditor);
({

Check failure on line 102 in src/test/unit/snykOss/services/vulnerabilityCount/ossVulnerabilityCountService.test.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Insert `··`
document: undefined,
} as unknown as TextEditor);
workspace.onDidChangeTextDocument = sinon.fake();
window.onDidChangeActiveTextEditor = sinon.fake();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { strictEqual } from 'assert';
import { Language } from '../../../../../../snyk/common/types';
import { BabelParser } from '../../../../../../snyk/snykOss/services/vulnerabilityCount/parsers/babelParser';
import { BabelParser } from '../../../../../../snyk/snykOssOld/services/vulnerabilityCount/parsers/babelParser';

/**
* ES Import statements documentation:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepStrictEqual, strictEqual } from 'assert';
import { Range } from '../../../../../../snyk/snykOss/services/vulnerabilityCount/importedModule';
import { HtmlParser } from '../../../../../../snyk/snykOss/services/vulnerabilityCount/parsers/htmlParser';
import { Range } from '../../../../../../snyk/snykOssOld/services/vulnerabilityCount/importedModule';
import { HtmlParser } from '../../../../../../snyk/snykOssOld/services/vulnerabilityCount/parsers/htmlParser';

suite('HTML Parser', () => {
let parser: HtmlParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { strictEqual } from 'assert';
import { IConfiguration } from '../../../../../../snyk/common/configuration/configuration';
import { ModuleParserProvider } from '../../../../../../snyk/common/services/moduleParserProvider';
import { Language } from '../../../../../../snyk/common/types';
import { BabelParser } from '../../../../../../snyk/snykOss/services/vulnerabilityCount/parsers/babelParser';
import { BabelParser } from '../../../../../../snyk/snykOssOld/services/vulnerabilityCount/parsers/babelParser';
import { LoggerMock } from '../../../../mocks/logger.mock';

suite('OSS ModuleParserProvider', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { strictEqual } from 'assert';
import { PackageJsonParser } from '../../../../../../snyk/snykOss/services/vulnerabilityCount/parsers/packageJsonParser';
import { PackageJsonParser } from '../../../../../../snyk/snykOssOld/services/vulnerabilityCount/parsers/packageJsonParser';
import { LoggerMock } from '../../../../mocks/logger.mock';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { deepStrictEqual, strictEqual } from 'assert';
import sinon from 'sinon';
import { CliError } from '../../../../../snyk/cli/services/cliService';
import { Language } from '../../../../../snyk/common/types';
import { OssResultBody, OssVulnerability } from '../../../../../snyk/snykOss/ossResult';
import { OssService } from '../../../../../snyk/snykOss/services/ossService';
import { ImportedModule } from '../../../../../snyk/snykOss/services/vulnerabilityCount/importedModule';
import { ModuleVulnerabilityCountProvider } from '../../../../../snyk/snykOss/services/vulnerabilityCount/vulnerabilityCountProvider';
import { ILanguageClientAdapter } from '../../../../../snyk/common/vscode/languageClient';
import { IUriAdapter } from '../../../../../snyk/common/vscode/uri';
import { ITextDocumentAdapter } from '../../../../../snyk/common/vscode/textdocument';
import { IUriAdapter } from '../../../../../snyk/common/vscode/uri';
import { OssResultBody, OssVulnerability } from '../../../../../snyk/snykOssOld/ossResult';
import { OssService } from '../../../../../snyk/snykOssOld/services/ossService';
import { ImportedModule } from '../../../../../snyk/snykOssOld/services/vulnerabilityCount/importedModule';
import { ModuleVulnerabilityCountProvider } from '../../../../../snyk/snykOssOld/services/vulnerabilityCount/vulnerabilityCountProvider';

suite('OSS ModuleVulnerabilityCountProvider', () => {
let ossService: OssService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { strictEqual } from 'assert';
import sinon from 'sinon';
import { IExtension } from '../../../../../snyk/base/modules/interfaces';
import { DailyScanJob } from '../../../../../snyk/snykOss/watchers/dailyScanJob';
import { DailyScanJob } from '../../../../../snyk/snykOssOld/watchers/dailyScanJob';

suite('OSS DailyScanJob', () => {
let extension: IExtension;
Expand Down

0 comments on commit 78a8100

Please sign in to comment.