Skip to content

Commit

Permalink
feat: added remediation and recommendation quickfix feature
Browse files Browse the repository at this point in the history
Signed-off-by: Ilona Shishov <[email protected]>
  • Loading branch information
IlonaShishov committed Dec 17, 2023
1 parent ac384e6 commit bfb2ec6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@fabric8-analytics/fabric8-analytics-lsp-server": "^0.8.1-ea.3",
"@fabric8-analytics/fabric8-analytics-lsp-server": "^0.8.1-ea.4",
"@redhat-developer/vscode-redhat-telemetry": "^0.7.0",
"@RHEcosystemAppEng/exhort-javascript-api": "^0.1.1-ea.3",
"@RHEcosystemAppEng/exhort-javascript-api": "^0.1.1-ea.4",
"fs": "^0.0.1-security",
"path": "^0.12.7",
"vscode-languageclient": "^8.1.0"
Expand Down
3 changes: 2 additions & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export const TRIGGER_FULL_STACK_ANALYSIS_FROM_STATUS_BAR = 'fabric8.stackAnalysi
export const TRIGGER_FULL_STACK_ANALYSIS_FROM_EXPLORER = 'fabric8.stackAnalysisFromExplorer';
export const TRIGGER_FULL_STACK_ANALYSIS_FROM_PIE_BTN = 'fabric8.stackAnalysisFromPieBtn';
export const TRIGGER_FULL_STACK_ANALYSIS_FROM_EDITOR = 'fabric8.stackAnalysisFromEditor';
export const TRIGGER_STACK_LOGS = 'fabric8.fabric8AnalyticsStackLogs';
export const TRIGGER_STACK_LOGS = 'fabric8.fabric8AnalyticsStackLogs';
export const TRIGGER_REDHAT_REPOSITORY_RECOMMENDATION_NOTIFICATION = 'fabric8.RHRepositoryRecommendationNotification';
3 changes: 3 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { getTelemetryId } from './redhatTelemetry';
class Config {
telemetryId: string;
triggerFullStackAnalysis: string;
triggerRHRepositoryRecommendationNotification: string;
utmSource: string;
exhortSnykToken: string;
exhortOSSIndexUser: string;
Expand Down Expand Up @@ -72,6 +73,7 @@ class Config {
const apiConfig = this.getRhdaConfig();

this.triggerFullStackAnalysis = commands.TRIGGER_FULL_STACK_ANALYSIS;
this.triggerRHRepositoryRecommendationNotification = commands.TRIGGER_REDHAT_REPOSITORY_RECOMMENDATION_NOTIFICATION;
this.utmSource = GlobalState.UTM_SOURCE;
this.exhortSnykToken = apiConfig.exhortSnykToken;
this.exhortOSSIndexUser = apiConfig.exhortOSSIndexUser;
Expand All @@ -93,6 +95,7 @@ class Config {
*/
private setProcessEnv() {
process.env['VSCEXT_TRIGGER_FULL_STACK_ANALYSIS'] = this.triggerFullStackAnalysis;
process.env['VSCEXT_TRIGGER_REDHAT_REPOSITORY_RECOMMENDATION_NOTIFICATION'] = this.triggerRHRepositoryRecommendationNotification;
process.env['VSCEXT_UTM_SOURCE'] = this.utmSource;
process.env['VSCEXT_EXHORT_SNYK_TOKEN'] = this.exhortSnykToken;
process.env['VSCEXT_EXHORT_OSS_INDEX_USER'] = this.exhortOSSIndexUser;
Expand Down
14 changes: 13 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import * as path from 'path';

import * as commands from './commands';
import { GlobalState, extensionQualifiedId } from './constants';
import { GlobalState, extensionQualifiedId, redhatMavenRepository, redhatMavenRepositoryDocumentationURL } from './constants';
import { generateRHDAReport } from './stackAnalysis';
import { globalConfig } from './config';
import { StatusMessages, PromptText } from './constants';
Expand Down Expand Up @@ -60,6 +60,17 @@ export function activate(context: vscode.ExtensionContext) {
}
);

const rhRepositoryRecommendationNotification = vscode.commands.registerCommand(
commands.TRIGGER_REDHAT_REPOSITORY_RECOMMENDATION_NOTIFICATION,
() => {
const msg = `Important: If you apply Red Hat Dependency Analytics recommendations,
make sure the Red Hat GA Repository (${redhatMavenRepository}) has been added to your project configuration.
This ensures that the applied dependencies work correctly.
Learn how to add the repository: [Click here](${redhatMavenRepositoryDocumentationURL})`;
vscode.window.showWarningMessage(msg);
}
);

registerStackAnalysisCommands(context);

globalConfig.authorizeRHDA(context)
Expand Down Expand Up @@ -146,6 +157,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
disposableStackAnalysisCommand,
disposableStackLogsCommand,
rhRepositoryRecommendationNotification,
caStatusBarProvider,
);
})
Expand Down

0 comments on commit bfb2ec6

Please sign in to comment.