Skip to content

Commit 168d7fd

Browse files
feat: add project scan capability, preserve workspace scan function [ROAD-1239] (#119)
* feat: ✨ scan project (instead of workspace) when triggering project scan from context menu * feat: ✨ add new Snyk Test Workspace context menu item * docs: updated CHANGELOG.md * chore: bump required protocol version to 5 for new command. * fix: update httpcomponents to 4.5.14 * docs: update CHANGELOG.md * fix: remove redundant if
1 parent fe8dd25 commit 168d7fd

12 files changed

Lines changed: 72 additions & 30 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
## [2.0.0] - Unreleased
44
### Changes
5-
- submit runtime information of jdk and os to language server
5+
- Snyk Test now scans the selected project
6+
- Added new Snyk Test Workspace command
7+
8+
## [2.0.0] - v20221222.164444
9+
### Changes
10+
- Submit runtime information of jdk and os to language server
11+
12+
### Fixed
13+
- NPE when finishing Snyk Wizard in empty workspace
614

715
## [2.0.0] - v20221220.094322
816
### Changes

plugin/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Bundle-ClassPath: .,
2929
target/dependency/commons-codec-1.15.jar,
3030
target/dependency/commons-lang3-3.12.0.jar,
3131
target/dependency/commons-logging-1.2.jar,
32-
target/dependency/httpclient-4.5.13.jar,
32+
target/dependency/httpclient-4.5.14.jar,
3333
target/dependency/httpcore-4.4.16.jar,
3434
target/dependency/jackson-annotations-2.14.1.jar,
3535
target/dependency/jackson-core-2.14.1.jar,

plugin/OSGI-INF/l10n/bundle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ page.name=Snyk
88
command.name=Run
99
command.label=Snyk Test
1010
command.label.0=Snyk Test
11+
12+
scanWorkspace.name=snykWorkspaceScan
13+
scanWorkspace.label=Snyk Test Workspace
14+
command.label.0=Snyk Test Workspace
15+

plugin/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ bin.includes = plugin.xml,\
1010
target/dependency/commons-codec-1.15.jar,\
1111
target/dependency/commons-lang3-3.12.0.jar,\
1212
target/dependency/commons-logging-1.2.jar,\
13-
target/dependency/httpclient-4.5.13.jar,\
13+
target/dependency/httpclient-4.5.14.jar,\
1414
target/dependency/httpcore-4.4.16.jar,\
1515
target/dependency/jackson-annotations-2.14.1.jar,\
1616
target/dependency/jackson-core-2.14.1.jar,\

plugin/io.snyk.eclipse.plugin.eml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<lib name="commons-logging-1.2.jar" scope="COMPILE">
1414
<relative-module-cls project-related="jar://$PROJECT_DIR$/plugin/target/dependency/commons-logging-1.2.jar!/"/>
1515
</lib>
16-
<lib name="httpclient-4.5.13.jar" scope="COMPILE">
17-
<relative-module-cls project-related="jar://$PROJECT_DIR$/plugin/target/dependency/httpclient-4.5.13.jar!/"/>
16+
<lib name="httpclient-4.5.14.jar" scope="COMPILE">
17+
<relative-module-cls project-related="jar://$PROJECT_DIR$/plugin/target/dependency/httpclient-4.5.14.jar!/"/>
1818
</lib>
1919
<lib name="httpcore-4.4.16.jar" scope="COMPILE">
2020
<relative-module-cls project-related="jar://$PROJECT_DIR$/plugin/target/dependency/httpcore-4.4.16.jar!/"/>
@@ -37,7 +37,7 @@
3737
<level name="Maven: com.fasterxml.jackson.core:jackson-databind:2.14.1" value="project"/>
3838
<level name="Maven: org.apache.commons:commons-lang3:3.12.0" value="project"/>
3939
<level name="Maven: org.apache.httpcomponents:httpcore:4.4.16" value="project"/>
40-
<level name="Maven: org.apache.httpcomponents:httpclient:4.5.13" value="project"/>
40+
<level name="Maven: org.apache.httpcomponents:httpclient:4.5.14" value="project"/>
4141
<level name="Maven: commons-logging:commons-logging:1.2" value="project"/>
4242
<level name="Maven: commons-codec:commons-codec:1.15" value="project"/>
4343
<level name="Maven: javax.inject:javax.inject:1" value="project"/>

plugin/plugin.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
id="io.snyk.eclipse.plugin.commands.execute"
5252
name="%command.name">
5353
</command>
54+
<command
55+
defaultHandler="io.snyk.eclipse.plugin.views.ScanWorkspaceMenuHandler"
56+
id="io.snyk.eclipse.plugin.commands.snykWorkspaceScan"
57+
name="%scanWorkspace.name">
58+
</command>
5459
</extension>
5560
<extension
5661
point="org.eclipse.ui.menus">
@@ -73,6 +78,12 @@
7378
</with>
7479
</visibleWhen>
7580
</command>
81+
<command
82+
commandId="io.snyk.eclipse.plugin.commands.snykWorkspaceScan"
83+
icon="icons/patch.png"
84+
label="%scanWorkspace.label"
85+
style="push">
86+
</command>
7687
</menuContribution>
7788
</extension>
7889
<extension point="org.eclipse.ui.menus">
@@ -93,6 +104,12 @@
93104
</with>
94105
</visibleWhen>
95106
</command>
107+
<command
108+
commandId="io.snyk.eclipse.plugin.commands.snykWorkspaceScan"
109+
icon="icons/patch.png"
110+
label="%scanWorkspace.label"
111+
style="push">
112+
</command>
96113
</menuContribution>
97114
</extension>
98115
<extension point="org.eclipse.ui.startup">

plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<dependency>
4747
<groupId>org.apache.httpcomponents</groupId>
4848
<artifactId>httpclient</artifactId>
49-
<version>4.5.13</version>
49+
<version>4.5.14</version>
5050
<exclusions>
5151
<exclusion>
5252
<!-- fix vulnerability in referenced dependency by adding it explicitly below and excluding it here -->
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.snyk.eclipse.plugin.views;
2+
3+
import org.eclipse.core.commands.AbstractHandler;
4+
import org.eclipse.core.commands.ExecutionEvent;
5+
import org.eclipse.core.commands.ExecutionException;
6+
import org.eclipse.ui.IWorkbenchWindow;
7+
import org.eclipse.ui.handlers.HandlerUtil;
8+
9+
import io.snyk.languageserver.protocolextension.SnykExtendedLanguageClient;
10+
11+
public class ScanWorkspaceMenuHandler extends AbstractHandler {
12+
13+
public Object execute(ExecutionEvent event) throws ExecutionException {
14+
SnykExtendedLanguageClient.getInstance().triggerScan(null);
15+
return null;
16+
}
17+
}

plugin/src/main/java/io/snyk/eclipse/plugin/views/SnykView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ public void run() {
213213
public void run() {
214214
if (alreadyRunning)
215215
return;
216-
showMessage(RUNNING);
217216
scanWorkspace.setEnabled(false);
218217
abortScanning.setEnabled(true);
218+
showMessage(RUNNING);
219219

220220
CompletableFuture.runAsync(() -> {
221221
SnykExtendedLanguageClient.getInstance().triggerScan(null);
@@ -285,9 +285,9 @@ public void enableScanBasedOnConfig() {
285285
public void testProject(String projectName) {
286286
if (alreadyRunning)
287287
return;
288-
showMessage(RUNNING);
289288
scanWorkspace.setEnabled(false);
290289
abortScanning.setEnabled(true);
290+
showMessage(RUNNING);
291291

292292
CompletableFuture.runAsync(() -> {
293293
alreadyRunning = true;

plugin/src/main/java/io/snyk/languageserver/download/LsBinaries.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public class LsBinaries {
66
private static final String LS_DOWNLOAD_BASE_URL = "https://static.snyk.io/snyk-ls";
7-
public static final String REQUIRED_LS_PROTOCOL_VERSION = "4";
7+
public static final String REQUIRED_LS_PROTOCOL_VERSION = "5";
88

99
public static URI getBaseUri() {
1010
return URI.create(String.format("%s/%s", LS_DOWNLOAD_BASE_URL, REQUIRED_LS_PROTOCOL_VERSION));

0 commit comments

Comments
 (0)