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

NEW (Extension) @W-14001840@: Add ability to cancel graph engine runs #70

Merged
merged 11 commits into from
May 16, 2024

Conversation

jag-j
Copy link
Collaborator

@jag-j jag-j commented May 9, 2024

No description provided.

@jag-j jag-j marked this pull request as ready for review May 10, 2024 21:50
@jag-j jag-j requested a review from jfeingold35 May 13, 2024 13:46
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have these messages gone through Text Review?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am working with @jshackell-sfdc on those.

@@ -25,8 +25,13 @@ export const messages = {
graphEngine: {
noViolationsFound: "Scan was completed. No violations found.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this message still used anywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is still used when there are no violations found. I tried this with some empty methods and made sure this is thrown.

src/extension.ts Show resolved Hide resolved
src/test/suite/extension.test.ts Outdated Show resolved Hide resolved
src/test/suite/extension.test.ts Outdated Show resolved Hide resolved
@jag-j jag-j requested a review from jfeingold35 May 13, 2024 16:17
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated
@@ -94,10 +111,27 @@ export async function activate(context: vscode.ExtensionContext): Promise<vscode
return Promise.resolve(context);
}

export async function _stopExistingDfaRun(context: vscode.ExtensionContext, outputChannel: vscode.LogOutputChannel) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a matter of style, typescript functions should have return types declared, so this should be : Promise<void>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 128 has void on it... which is why the compiler is happy. It took me a minute on this one as well... so just for readability/consistency we can remove the void on line 128 and add in : Promise as Josh is suggesting.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add Promise. I still want to keep line 128 with void in it. Seems like that's the preference for updating caches (by not blocking the original function by using await).

src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated
.then(async answer => {
if (answer === messages.graphEngine.stopDfaRunConfirmationYes) {
await _stopExistingDfaRun(context, channel);
return true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this callback return true here? The return value isn't used anywhere as far as I can tell. Also, right now there are cases where it won't return anything, which seems like it's a problem.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, this should be here.

src/lib/scanner.ts Show resolved Hide resolved
src/extension.ts Outdated
@@ -94,10 +111,27 @@ export async function activate(context: vscode.ExtensionContext): Promise<vscode
return Promise.resolve(context);
}

export async function _stopExistingDfaRun(context: vscode.ExtensionContext, outputChannel: vscode.LogOutputChannel) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 128 has void on it... which is why the compiler is happy. It took me a minute on this one as well... so just for readability/consistency we can remove the void on line 128 and add in : Promise as Josh is suggesting.

src/extension.ts Outdated
@@ -94,10 +111,27 @@ export async function activate(context: vscode.ExtensionContext): Promise<vscode
return Promise.resolve(context);
}

export async function _stopExistingDfaRun(context: vscode.ExtensionContext, outputChannel: vscode.LogOutputChannel) {
const pid = context.workspaceState.get(Constants.GLOBAL_DFA_PROCESS);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick. Now that it is a workspace setting and not a global setting. Do we want the name of the constant to still be GLOBAL_DFA_PROCESS?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will take care of this.

@jag-j jag-j merged commit 7bbb3d5 into dev May 16, 2024
7 checks passed
@jag-j jag-j deleted the jj/W-14001840 branch May 16, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants