Skip to content

Commit d71f7f1

Browse files
authored
fix: move filtering ignored issues to the LS [IDE-899] (#278)
Including updating the wording for issues found summaries since we now won't always know the count of open & ignored issues.
1 parent ae36cb6 commit d71f7f1

File tree

11 files changed

+352
-235
lines changed

11 files changed

+352
-235
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package io.snyk.eclipse.plugin.properties;
2+
3+
public record IssueViewOptions(boolean openIssues, boolean ignoredIssues) {}

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/ISnykToolView.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,53 @@
1111
*/
1212
public interface ISnykToolView {
1313
String CONGRATS_NO_ISSUES_FOUND = "✅ Congrats! No issues found!";
14+
String CONGRATS_NO_OPEN_ISSUES_FOUND = "✅ Congrats! No open issues found!";
15+
String OPEN_ISSUES_ARE_DISABLED = "Open issues are disabled!";
16+
String NO_IGNORED_ISSUES = "✋ No ignored issues, open issues are disabled";
17+
String OPEN_AND_IGNORED_ISSUES_ARE_DISABLED = "Open and Ignored issues are disabled!";
1418
String NO_FIXABLE_ISSUES = "There are no issues automatically fixable.";
15-
String IGNORED_ISSUES_FILTERED_BUT_AVAILABLE = "Adjust your Issue View Options to see ignored issues.";
16-
String OPEN_ISSUES_FILTERED_BUT_AVAILABLE = "Adjust your Issue View Options to see open issues.";
19+
String IGNORED_ISSUES_FILTERED_BUT_AVAILABLE = "Adjust your settings to view Ignored issues.";
20+
String OPEN_ISSUES_FILTERED_BUT_AVAILABLE = "Adjust your settings to view Open issues.";
21+
String ALL_ISSUES_FILTERED_BUT_AVAILABLE = "Adjust your settings to view Open or Ignored issues.";
1722

1823
String NODE_TEXT_SCANNING = "Scanning...";
19-
String NODE_TEXT_NO_ISSUES_FOUND = "No issues found";
2024
String NODE_TEXT_ERROR = "An error occurred";
2125

2226
/**
2327
* Updates the text of the given node
24-
*
28+
*
2529
* @param node
2630
* @param text
2731
*/
2832
abstract void setNodeText(BaseTreeNode node, String text);
2933

3034
/**
3135
* Adds an issue node to the parent (usually a file node)
32-
*
36+
*
3337
* @param parent
3438
* @param toBeAdded
3539
*/
3640
abstract void addIssueNode(FileTreeNode parent, IssueTreeNode toBeAdded);
3741

3842
/**
3943
* Adds a file node (usually below the product node)
40-
*
44+
*
4145
* @param parent
4246
* @param toBeAdded
4347
*/
4448
abstract void addFileNode(ProductTreeNode parent, FileTreeNode toBeAdded);
4549

4650
/**
4751
* Adds an info node (usually below the product node)
48-
*
52+
*
4953
* @param parent
5054
* @param toBeAdded
5155
*/
5256
abstract void addInfoNode(ProductTreeNode parent, InfoTreeNode toBeAdded);
5357

5458
/**
5559
* Returns the product node
56-
*
60+
*
5761
* @param product the product. ProductConstants#DISPLAY_
5862
* @param folderPath TODO*
5963
* @return
@@ -67,7 +71,7 @@ public interface ISnykToolView {
6771

6872
/**
6973
* Remove all info nodes from the product tree node
70-
*
74+
*
7175
* @param node
7276
*/
7377
abstract void removeInfoNodes(ProductTreeNode node);
@@ -94,41 +98,37 @@ public interface ISnykToolView {
9498

9599
/**
96100
* Returns the tree root
97-
*
101+
*
98102
* @return
99103
*/
100104
abstract BaseTreeNode getRoot();
101105

102106
/**
103107
* Clears all nodes in the tree
104-
*
108+
*
105109
* @return
106110
*/
107111
abstract void clearTree();
108112

109-
static String getPlural(long count) {
110-
return count > 1 ? "s" : "";
111-
}
112-
113113
abstract TreeViewer getTreeViewer();
114114

115115
/**
116116
* Hides or shows the Ignore buttons.
117-
*
117+
*
118118
* @return
119119
*/
120120
abstract void toggleIgnoresButtons();
121121

122122
/**
123123
* Enables the net new issues scans.
124-
*
124+
*
125125
* @return
126126
*/
127127
abstract void enableDelta();
128128

129129
/**
130130
* Disable the net new issues scans.
131-
*
131+
*
132132
* @return
133133
*/
134134
abstract void disableDelta();

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/TreeFilterManager.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
import io.snyk.eclipse.plugin.SnykStartup;
1717
import io.snyk.eclipse.plugin.views.snyktoolview.filters.FixableFilter;
18-
import io.snyk.eclipse.plugin.views.snyktoolview.filters.IgnoresIgnoredIssuesFilter;
19-
import io.snyk.eclipse.plugin.views.snyktoolview.filters.IgnoresOpenIssuesFilter;
2018
import io.snyk.eclipse.plugin.views.snyktoolview.filters.ProductFilter;
2119
import io.snyk.eclipse.plugin.views.snyktoolview.filters.SeverityFilter;
2220
import io.snyk.languageserver.protocolextension.messageObjects.scanResults.Issue;
@@ -49,10 +47,6 @@ private void setupFilters(TreeFilterManager tfm) {
4947
new ProductFilter(tfm, ACTIVATE_SNYK_CODE_SECURITY).applyFilter();
5048
new ProductFilter(tfm, ACTIVATE_SNYK_CODE_QUALITY).applyFilter();
5149

52-
// Ignores filters
53-
new IgnoresIgnoredIssuesFilter(tfm).applyFilter();
54-
new IgnoresOpenIssuesFilter(tfm).applyFilter();
55-
5650
// Fix
5751
new FixableFilter(tfm).applyFilter();
5852
}

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/filters/IgnoresIgnoredIssuesFilter.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/filters/IgnoresOpenIssuesFilter.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterIgnoresIgnoredIssuesHandler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import org.eclipse.ui.commands.IElementUpdater;
66

77
import io.snyk.eclipse.plugin.preferences.Preferences;
8-
import io.snyk.eclipse.plugin.views.snyktoolview.TreeFilterManager;
9-
import io.snyk.eclipse.plugin.views.snyktoolview.filters.IgnoresIgnoredIssuesFilter;
8+
import io.snyk.languageserver.protocolextension.SnykExtendedLanguageClient;
109

1110
public class FilterIgnoresIgnoredIssuesHandler extends BaseHandler implements IElementUpdater {
1211

@@ -19,7 +18,7 @@ public FilterIgnoresIgnoredIssuesHandler() {
1918
public Object execute(ExecutionEvent event) throws ExecutionException {
2019
super.execute(event);
2120

22-
new IgnoresIgnoredIssuesFilter(TreeFilterManager.getInstance()).applyFilter();
21+
SnykExtendedLanguageClient.getInstance().updateConfiguration();
2322

2423
return null;
2524
}

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/FilterIgnoresOpenIssuesHandler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import org.eclipse.ui.commands.IElementUpdater;
66

77
import io.snyk.eclipse.plugin.preferences.Preferences;
8-
import io.snyk.eclipse.plugin.views.snyktoolview.TreeFilterManager;
9-
import io.snyk.eclipse.plugin.views.snyktoolview.filters.IgnoresOpenIssuesFilter;
8+
import io.snyk.languageserver.protocolextension.SnykExtendedLanguageClient;
109

1110
public class FilterIgnoresOpenIssuesHandler extends BaseHandler implements IElementUpdater {
1211

@@ -19,7 +18,7 @@ public FilterIgnoresOpenIssuesHandler() {
1918
public Object execute(ExecutionEvent event) throws ExecutionException {
2019
super.execute(event);
2120

22-
new IgnoresOpenIssuesFilter(TreeFilterManager.getInstance()).applyFilter();
21+
SnykExtendedLanguageClient.getInstance().updateConfiguration();
2322

2423
return null;
2524
}

plugin/src/main/java/io/snyk/languageserver/LsConfigurationUpdater.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import io.snyk.eclipse.plugin.Activator;
1212
import io.snyk.eclipse.plugin.preferences.Preferences;
1313
import io.snyk.eclipse.plugin.properties.FolderConfigs;
14+
import io.snyk.eclipse.plugin.properties.IssueViewOptions;
1415
import io.snyk.languageserver.download.LsBinaries;
1516
import io.snyk.languageserver.protocolextension.SnykExtendedLanguageClient;
1617
import io.snyk.languageserver.protocolextension.messageObjects.FolderConfig;
@@ -42,6 +43,10 @@ Settings getCurrentSettings() {
4243
String additionalParams = preferences.getPref(Preferences.ADDITIONAL_PARAMETERS, "");
4344
String additionalEnv = preferences.getPref(Preferences.ADDITIONAL_ENVIRONMENT, "");
4445
String path = preferences.getPref(Preferences.PATH_KEY, "");
46+
IssueViewOptions issueViewOptions = new IssueViewOptions(
47+
preferences.getBooleanPref(Preferences.FILTER_IGNORES_SHOW_OPEN_ISSUES, true),
48+
preferences.getBooleanPref(Preferences.FILTER_IGNORES_SHOW_IGNORED_ISSUES, false)
49+
);
4550
String sendErrorReports = preferences.getPref(Preferences.SEND_ERROR_REPORTS, "");
4651
String enableTelemetry = preferences.getPref(Preferences.ENABLE_TELEMETRY, Boolean.FALSE.toString());
4752
String organization = preferences.getPref(Preferences.ORGANIZATION_KEY, "");
@@ -73,7 +78,7 @@ Settings getCurrentSettings() {
7378
}
7479

7580
return new Settings(activateSnykOpenSource, activateSnykCodeSecurity, activateSnykCodeQuality, activateSnykIac,
76-
insecure, endpoint, additionalParams, additionalEnv, path, sendErrorReports, enableTelemetry,
81+
insecure, endpoint, additionalParams, additionalEnv, path, issueViewOptions, sendErrorReports, enableTelemetry,
7782
organization, manageBinariesAutomatically, cliPath, token, integrationName, integrationVersion,
7883
automaticAuthentication, trustedFolders, enableTrustedFolderFeature, scanningMode, enableDeltaFindings,
7984
authMethod, folderConfigs);
@@ -90,6 +95,7 @@ static class Settings {
9095
private final String additionalParams;
9196
private final String additionalEnv;
9297
private final String path;
98+
private final IssueViewOptions issueViewOptions;
9399
private final String sendErrorReports;
94100
private final String enableTelemetry;
95101
private final String organization;
@@ -113,7 +119,7 @@ static class Settings {
113119

114120
public Settings(String activateSnykOpenSource, String activateSnykCodeSecurity, String activateSnykCodeQuality,
115121
String activateSnykIac, String insecure, String endpoint, String additionalParams, String additionalEnv,
116-
String path, String sendErrorReports, String enableTelemetry, String organization,
122+
String path, IssueViewOptions issueViewOptions, String sendErrorReports, String enableTelemetry, String organization,
117123
String manageBinariesAutomatically, String cliPath, String token, String integrationName,
118124
String integrationVersion, String automaticAuthentication, String[] trustedFolders,
119125
String enableTrustedFoldersFeature, String scanningMode, String enableDeltaFindings, String authMethod,List<FolderConfig>folderConfigs) {
@@ -126,6 +132,7 @@ public Settings(String activateSnykOpenSource, String activateSnykCodeSecurity,
126132
this.additionalParams = additionalParams;
127133
this.additionalEnv = additionalEnv;
128134
this.path = path;
135+
this.issueViewOptions = issueViewOptions;
129136
this.sendErrorReports = sendErrorReports;
130137
this.enableTelemetry = enableTelemetry;
131138
this.organization = organization;
@@ -179,6 +186,10 @@ public String getAdditionalEnv() {
179186
return additionalEnv;
180187
}
181188

189+
public IssueViewOptions getIssueViewOptions() {
190+
return this.issueViewOptions;
191+
}
192+
182193
public String getSendErrorReports() {
183194
return this.sendErrorReports;
184195
}

0 commit comments

Comments
 (0)