Skip to content

Commit

Permalink
Bug fix 4 (#74)
Browse files Browse the repository at this point in the history
* updated package json

* fixed policy getting added multiple times in hover

* org name added

* bug fix

* bug fix

* message updated

* files renamed

* service files renamed

* provider files renamed

* command files renamed

* helper files renamed

---------

Co-authored-by: Nagarjun Sanji <[email protected]>
Co-authored-by: Rajpreet Singh <[email protected]>
  • Loading branch information
3 people authored Oct 17, 2024
1 parent 4494e92 commit 8fd717d
Show file tree
Hide file tree
Showing 58 changed files with 125 additions and 104 deletions.
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@
"workspaceContains:**/package.json"
],
"main": "./dist/extension.js",
"homepage": "https://github.com/debricked/VS-Code-extension",
"repository": {
"type": "git",
"url": "https://github.com/debricked/VS-Code-extension"
},
"bugs": {
"url": "https://github.com/debricked/VS-Code-extension/issues"
},
"galleryBanner": {
"color": "#0D1840",
"theme": "dark"
},
"contributes": {
"viewsContainers": {
"activitybar": [
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DebrickedCommand } from "./debrickedCommand";
import { DebrickedCommand } from "./debricked.command";

const debrickedCommand = new DebrickedCommand();
export { debrickedCommand };
1 change: 1 addition & 0 deletions src/constants/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ export class Messages {

// Miscellaneous Messages
static readonly RESET_SUCCESS = "Successfully reset debricked.";
static readonly SCANNING_INPROGRESS = "Scan is still in process. Please wait...";
}
2 changes: 1 addition & 1 deletion src/helpers/apiHelper.ts → src/helpers/api.helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApiClient } from "./apiClient";
import { RequestParam } from "../types";
import { Logger } from "./loggerHelper";
import { Logger } from "./logger.helper";
import { SecondService } from "../constants";

export class ApiHelper {
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/apiClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from "axios";
import { AuthHelper } from "./authHelper";
import { AuthHelper } from "./auth.helper";
import { ErrorHandler } from "./errorHandler";
import { Logger } from "./loggerHelper";
import { Logger } from "./logger.helper";
import { Secrets } from "../constants";
import * as Sentry from "@sentry/node";

Expand Down
6 changes: 3 additions & 3 deletions src/helpers/authHelper.ts → src/helpers/auth.helper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Messages, Secrets } from "../constants/index";
import { ShowInputBoxHelper } from "./showInputBoxHelper";
import { StatusBarMessageHelper } from "./statusBarMessageHelper";
import { Logger } from "./loggerHelper";
import { ShowInputBoxHelper } from "./showInputBox.helper";
import { StatusBarMessageHelper } from "./statusBarMessage.helper";
import { Logger } from "./logger.helper";
import { GlobalStore } from "./globalStore";

export class AuthHelper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { DebrickedCommands, Messages, MessageStatus, Secrets } from "../constant
import { exec } from "child_process";
import * as vscode from "vscode";
import { promisify } from "util";
import { AuthHelper } from "./authHelper";
import { Logger } from "./loggerHelper";
import { AuthHelper } from "./auth.helper";
import { Logger } from "./logger.helper";
import * as Sentry from "@sentry/node";

export class Command {
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/commonHelper.ts → src/helpers/common.helper.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { MessageStatus, Organization, SupportedFilesToScan } from "../constants/index";
import * as crypto from "crypto";
import { Logger } from "./loggerHelper";
import { ShowInputBoxHelper } from "./showInputBoxHelper";
import { Logger } from "./logger.helper";
import { ShowInputBoxHelper } from "./showInputBox.helper";
import { GlobalStore } from "./globalStore";
import path from "path";
import * as vscode from "vscode";
import { StatusBarMessageHelper } from "./statusBarMessageHelper";
import { StatusBarMessageHelper } from "./statusBarMessage.helper";

export class Common {
constructor(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ApiHelper } from "./apiHelper";
import { ApiHelper } from "./api.helper";
import { DependencyResponse, DependencyVulnerabilityWrapper, Repository, RequestParam } from "../types/index";
import { Logger } from "./loggerHelper";
import { Logger } from "./logger.helper";
import { SecondService } from "../constants";
import { SentryHelper } from "./sentryHelper";
import { SentryHelper } from "./sentry.helper";

export class DebrickedServiceHelper {
private readonly apiHelper: ApiHelper;
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/errorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Logger } from "./loggerHelper";
import { StatusBarMessageHelper } from "./statusBarMessageHelper";
import { SentryHelper } from "./sentryHelper";
import { Logger } from "./logger.helper";
import { StatusBarMessageHelper } from "./statusBarMessage.helper";
import { SentryHelper } from "./sentry.helper";

export class ErrorHandler {
constructor(
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/fileHelper.ts → src/helpers/file.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as vscode from "vscode";
import * as fs from "fs";
import * as path from "path";
import { MessageStatus, Organization } from "../constants/index";
import { Logger } from "./loggerHelper";
import { DebrickedDataHelper } from "./debrickedDataHelper";
import { Logger } from "./logger.helper";
import { DebrickedDataHelper } from "./debrickedData.helper";

export class FileHelper {
constructor(
Expand Down
10 changes: 5 additions & 5 deletions src/helpers/gitHelper.ts → src/helpers/git.helper.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as path from "path";
import { Messages, MessageStatus } from "../constants/index";
import { Command } from "./commandHelper";
import { Command } from "./command.helper";
import { GlobalStore } from "./globalStore";
import { Logger } from "./loggerHelper";
import { ShowInputBoxHelper } from "./showInputBoxHelper";
import { StatusBarMessageHelper } from "./statusBarMessageHelper";
import { SentryHelper } from "./sentryHelper";
import { Logger } from "./logger.helper";
import { ShowInputBoxHelper } from "./showInputBox.helper";
import { StatusBarMessageHelper } from "./statusBarMessage.helper";
import { SentryHelper } from "./sentry.helper";

export class GitHelper {
constructor(
Expand Down
32 changes: 16 additions & 16 deletions src/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import * as vscode from "vscode";
import { AuthHelper } from "./authHelper";
import { StatusBarMessageHelper } from "./statusBarMessageHelper";
import { Terminal } from "./terminalHelper";
import { ShowQuickPickHelper } from "./showQuickPickHelper";
import { StatusMessage } from "./messageHelper";
import { Logger } from "./loggerHelper";
import { Common } from "./commonHelper";
import { Command } from "./commandHelper";
import { FileHelper } from "./fileHelper";
import { InstallHelper } from "./installHelper";
import { GitHelper } from "./gitHelper";
import { ShowInputBoxHelper } from "./showInputBoxHelper";
import { DebrickedDataHelper } from "./debrickedDataHelper";
import { AuthHelper } from "./auth.helper";
import { StatusBarMessageHelper } from "./statusBarMessage.helper";
import { Terminal } from "./terminal.helper";
import { ShowQuickPickHelper } from "./showQuickPick.helper";
import { StatusMessage } from "./message.helper";
import { Logger } from "./logger.helper";
import { Common } from "./common.helper";
import { Command } from "./command.helper";
import { FileHelper } from "./file.helper";
import { InstallHelper } from "./install.helper";
import { GitHelper } from "./git.helper";
import { ShowInputBoxHelper } from "./showInputBox.helper";
import { DebrickedDataHelper } from "./debrickedData.helper";
import { GlobalState } from "./globalState";
import { ApiHelper } from "./apiHelper";
import { ApiHelper } from "./api.helper";
import { ErrorHandler } from "./errorHandler";
import { ApiClient } from "./apiClient";
import { GlobalStore } from "./globalStore";
import { Organization } from "../constants";
import { Template } from "./template";
import { SentryHelper } from "./sentryHelper";
import { DebrickedServiceHelper } from "./debrickedServiceHelper";
import { SentryHelper } from "./sentry.helper";
import { DebrickedServiceHelper } from "./debrickedService.helper";

class IndexHelper {
constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as path from "path";
import { Messages, MessageStatus, Organization } from "../constants/index";
import * as vscode from "vscode";
import { StatusBarMessageHelper } from "./statusBarMessageHelper";
import { Logger } from "./loggerHelper";
import { Command } from "./commandHelper";
import { StatusBarMessageHelper } from "./statusBarMessage.helper";
import { Logger } from "./logger.helper";
import { Command } from "./command.helper";

export class InstallHelper {
private scriptDir: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as path from "path";
import { Organization, MessageStatus } from "../constants/index";
import * as vscode from "vscode";
import { GlobalStore } from "./globalStore";
import { SentryHelper } from "./sentryHelper";
import { SentryHelper } from "./sentry.helper";

export class Logger {
private static logFilePath: string;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as Sentry from "@sentry/node";
import { Environment, MessageStatus, Organization, SecondService } from "../constants";
import { GlobalStore } from "./globalStore";
import { StatusBarMessageHelper } from "./statusBarMessageHelper";
import { StatusBarMessageHelper } from "./statusBarMessage.helper";

export class SentryHelper {
private static instance: SentryHelper;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DebrickedCommands, Messages, MessageStatus, Organization, Secrets } from "../constants/index";
import { AuthHelper } from "./authHelper";
import { Logger } from "./loggerHelper";
import { AuthHelper } from "./auth.helper";
import { Logger } from "./logger.helper";

import * as vscode from "vscode";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Package } from "types";
import { commonHelper, errorHandler, globalStore } from "../helpers";
import * as vscode from "vscode";
import { PolicyTriggerEvents, SecondService, SupportedFilesToScan } from "../constants";
import { Organization, PolicyTriggerEvents, SecondService, SupportedFilesToScan } from "../constants";

export class DependencyPolicyProvider implements vscode.CodeActionProvider {
constructor(private diagnosticCollection: vscode.DiagnosticCollection) {}
Expand Down Expand Up @@ -57,6 +57,7 @@ export class DependencyPolicyProvider implements vscode.CodeActionProvider {
value: packageData.cve ?? "Unknown reason",
target: vscode.Uri.parse(packageData.cveLink ?? SecondService.debrickedBaseUrl),
};
diagnostic.source = Organization.name;
diagnostics.push(diagnostic);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DebrickedCommandsTreeDataProvider } from "./debrickedCommandsTreeDataProvider";
import { ManifestDependencyHoverProvider } from "./manifestDependencyHoverProvider";
import { DebrickedCommandsTreeDataProvider } from "./debrickedCommandsTreeData.provider";
import { ManifestDependencyHoverProvider } from "./manifestDependencyHover.provider";
import * as vscode from "vscode";
import { MessageStatus } from "../constants/index";
import { Logger, errorHandler, gitHelper } from "../helpers";
import { DependencyPolicyProvider } from "./dependencyPolicyProvider";
import { DependencyPolicyProvider } from "./dependencyPolicy.provider";

class Providers {
public async registerHover(context: vscode.ExtensionContext) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions src/services/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BaseCommandService } from "./baseCommandService";
import { ScanService } from "./scanService";
import { DependencyService } from "./dependencyService";
import { AuthService } from "./authService";
import { PolicyRuleService } from "./policyRuleService";
import { BaseCommandService } from "./baseCommand.service";
import { ScanService } from "./scan.service";
import { DependencyService } from "./dependency.service";
import { AuthService } from "./auth.service";
import { PolicyRuleService } from "./policyRule.service";

const authService = new AuthService();
const dependencyService = new DependencyService();
Expand Down
File renamed without changes.
16 changes: 12 additions & 4 deletions src/services/scanService.ts → src/services/scan.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@ import {
debrickedServiceHelper,
showQuickPickHelper,
} from "../helpers";
import { DebrickedCommands, Icons, MessageStatus, Organization, SecondService, Secrets } from "../constants/index";
import {
DebrickedCommands,
Icons,
Messages,
MessageStatus,
Organization,
SecondService,
Secrets,
} from "../constants/index";
import { DebrickedCommandNode, Flag, Repository, RepositoryInfo } from "../types";
import * as vscode from "vscode";
import * as fs from "fs";
import { PolicyRuleService } from "./policyRuleService";
import { DependencyService } from "./dependencyService";
import { PolicyRuleService } from "./policyRule.service";
import { DependencyService } from "./dependency.service";

export class ScanService {
private readonly policyRuleService: PolicyRuleService;
Expand All @@ -32,7 +40,7 @@ export class ScanService {
const isRunning = globalStore.getScanningProgress();

if (isRunning) {
statusBarMessageHelper.showWarningMessage("Scan is still in process. Please wait...");
statusBarMessageHelper.showWarningMessage(Messages.SCANNING_INPROGRESS);
return;
} else {
globalStore.setScanningProgress(true);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApiHelper } from "../../helpers/apiHelper";
import { ApiHelper } from "../../helpers/api.helper";
import { ApiClient } from "../../helpers/apiClient";
import { Logger } from "../../helpers/loggerHelper";
import { Logger } from "../../helpers/logger.helper";
import { SecondService } from "../../constants";
import { RequestParam } from "../../types";
import { sinon, expect } from "../setup";
Expand Down
4 changes: 2 additions & 2 deletions src/test/helpers/apiClient.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { sinon, expect } from "../setup";
import { ApiClient } from "../../helpers/apiClient";
import { AuthHelper } from "../../helpers/authHelper";
import { AuthHelper } from "../../helpers/auth.helper";
import { ErrorHandler } from "../../helpers/errorHandler";
import { Logger } from "../../helpers/loggerHelper";
import { Logger } from "../../helpers/logger.helper";
import axios from "axios";

describe("ApiClient", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthHelper } from "../../helpers/authHelper";
import { AuthHelper } from "../../helpers/auth.helper";
import { Logger, showInputBoxHelper, statusBarMessageHelper } from "../../helpers";
import { sinon, expect } from "../setup";
import { Messages, Secrets } from "../../constants";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, sinon } from "../setup";
import { Command } from "../../helpers/commandHelper";
import { AuthHelper } from "../../helpers/authHelper";
import { Logger } from "../../helpers/loggerHelper";
import { Command } from "../../helpers/command.helper";
import { AuthHelper } from "../../helpers/auth.helper";
import { Logger } from "../../helpers/logger.helper";
import * as vscode from "vscode";

describe("Command", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as vscode from "vscode";
import { Common } from "../../helpers/commonHelper";
import { Logger } from "../../helpers/loggerHelper";
import { ShowInputBoxHelper } from "../../helpers/showInputBoxHelper";
import { Common } from "../../helpers/common.helper";
import { Logger } from "../../helpers/logger.helper";
import { ShowInputBoxHelper } from "../../helpers/showInputBox.helper";
import { GlobalStore } from "../../helpers/globalStore";
import { MessageStatus, Organization } from "../../constants";
import { expect, sinon } from "../setup";
import { StatusBarMessageHelper } from "../../helpers/statusBarMessageHelper";
import { StatusBarMessageHelper } from "../../helpers/statusBarMessage.helper";

describe("Common Helper", () => {
let common: Common;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from "../setup";
import { DebrickedDataHelper } from "../../helpers/debrickedDataHelper";
import { DebrickedDataHelper } from "../../helpers/debrickedData.helper";
import * as fs from "fs";

describe("DebrickedDataHelper", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { sinon, expect } from "../setup";
import { DebrickedServiceHelper } from "../../helpers/debrickedServiceHelper";
import { ApiHelper } from "../../helpers/apiHelper";
import { Logger } from "../../helpers/loggerHelper";
import { SentryHelper } from "../../helpers/sentryHelper";
import { DebrickedServiceHelper } from "../../helpers/debrickedService.helper";
import { ApiHelper } from "../../helpers/api.helper";
import { Logger } from "../../helpers/logger.helper";
import { SentryHelper } from "../../helpers/sentry.helper";
import * as Sentry from "@sentry/node";

describe("DebrickedServiceHelper", () => {
Expand Down
6 changes: 3 additions & 3 deletions src/test/helpers/errorHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ErrorHandler } from "../../helpers/errorHandler";
import { Logger } from "../../helpers/loggerHelper";
import { StatusBarMessageHelper } from "../../helpers/statusBarMessageHelper";
import { SentryHelper } from "../../helpers/sentryHelper";
import { Logger } from "../../helpers/logger.helper";
import { StatusBarMessageHelper } from "../../helpers/statusBarMessage.helper";
import { SentryHelper } from "../../helpers/sentry.helper";
import { expect, sinon } from "../setup";

describe("ErrorHandler", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sinon, expect } from "../setup";
import { FileHelper } from "../../helpers/fileHelper";
import { DebrickedDataHelper } from "../../helpers/debrickedDataHelper";
import { Logger } from "../../helpers/loggerHelper";
import { FileHelper } from "../../helpers/file.helper";
import { DebrickedDataHelper } from "../../helpers/debrickedData.helper";
import { Logger } from "../../helpers/logger.helper";
import * as vscode from "vscode";
import * as fs from "fs";
import * as path from "path";
Expand Down
Loading

0 comments on commit 8fd717d

Please sign in to comment.