Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
feat: show deprecation notification
Browse files Browse the repository at this point in the history
  • Loading branch information
michelkaporin authored and bmvermeer committed Nov 26, 2021
1 parent bb0713a commit 26f2a8e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Latest update 🗞️ (start here first 👇)
Vuln Cost is no longer being actively maintained. While you can continue to use this extension until it is officially deprecated, we recommend you install the official Snyk extension. This new extension provides all the functionality supported by Vuln Cost and enables you to find and fix issues in both your open source dependencies AND your custom code.

<p align="center"><a href="https://github.com/snyk/vulncost"><img src="https://raw.githubusercontent.com/snyk/vulncost/master/images/vuln_cost_logo_animated.gif" alt="Vuln Cost Animated Logo" height="60"/></a></p>
<h1 align="center">Vuln Cost</h1>
<p align="center">The world's easiest, Security Scanner for VS Code</p>

<p align="center">
<a href="https://snyk.io/test/github/snyk/vulncost"><img src="https://snyk.io/test/github/snyk/vulncost/badge.svg"/></a>
<a href="https://marketplace.visualstudio.com/items?itemName=snyk-security.vscode-vuln-cost"><img src="https://vsmarketplacebadge.apphb.com/installs-short/snyk-security.vscode-vuln-cost.svg"/></a> <a href="https://marketplace.visualstudio.com/items?itemName=snyk-security.vscode-vuln-cost"><img alt="Visual Studio Marketplace Version" src="https://img.shields.io/visual-studio-marketplace/v/snyk-security.vscode-vuln-cost?label=Marketplace&logo=visual-studio-code"></a>

</p><br/><br/>

<p align="center">
Expand Down
20 changes: 20 additions & 0 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import utm from './utm';
import statistics from './statistics';

const { window, workspace, commands } = vscode;
const deprecationNoteKey = 'deepcode.deprecationNoteMonth';

let isActive = true;
let packageWatcher = {};
Expand All @@ -27,6 +28,8 @@ export function activate(context) {
logger.init(context);
statistics.init(context);

void showDeprecationNotification(context);

if (isAuthed()) {
logger.log('🔒 Using Snyk credentials');
} else {
Expand Down Expand Up @@ -242,3 +245,20 @@ function language({ fileName, languageId }) {

return undefined;
}

async function showDeprecationNotification(context) {
const currentMonth = new Date().getMonth();
const lastMessageMonth = context.globalState.get(deprecationNoteKey);

if (!lastMessageMonth || currentMonth != lastMessageMonth) {
context.globalState.update(deprecationNoteKey, currentMonth);

const deprecationMessage = `The VulnCost extension is deprecated. Please use [Snyk Vulnerability Scanner](command:workbench.extensions.search?%22snyk-security.snyk-vulnerability-scanner%22) with included VulnCost's functionality and more.`;
const installCommandText = 'Install Snyk Vulnerability Scanner';

const selected = await vscode.window.showInformationMessage(deprecationMessage, installCommandText);
if (selected === installCommandText) {
vscode.commands.executeCommand('workbench.extensions.search', 'snyk-security.snyk-vulnerability-scanner');
}
}
}

0 comments on commit 26f2a8e

Please sign in to comment.