Skip to content

Commit 646fea8

Browse files
committed
fix: fix additional lint errors
1 parent 440de46 commit 646fea8

24 files changed

+242
-218
lines changed

plugin/src/main/java/io/snyk/eclipse/plugin/SnykStartup.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
public class SnykStartup implements IStartup {
3737
private static LsRuntimeEnvironment runtimeEnvironment;
38-
private static SnykToolView snykToolView = null;
38+
private static SnykToolView snykToolView;
3939
private static boolean downloading = true;
4040
private static ILog logger;
4141

@@ -116,7 +116,7 @@ private boolean downloadLS() {
116116
basicFileAttributes = Files.readAttributes(lsFile.toPath(), BasicFileAttributes.class);
117117
Instant lastModified = basicFileAttributes.lastModifiedTime().toInstant();
118118
boolean needsUpdate = lastModified.isBefore(Instant.now().minus(4, ChronoUnit.DAYS))
119-
|| !Preferences.getInstance().getLspVersion().equals(LsBinaries.REQUIRED_LS_PROTOCOL_VERSION);
119+
|| !LsBinaries.REQUIRED_LS_PROTOCOL_VERSION.equals(Preferences.getInstance().getLspVersion());
120120
logger.info(
121121
String.format("LS: Needs update? %s. Required LSP version=%s, actual version=%s", needsUpdate,
122122
LsBinaries.REQUIRED_LS_PROTOCOL_VERSION, Preferences.getInstance().getLspVersion()));

plugin/src/main/java/io/snyk/eclipse/plugin/html/CodeHtmlProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ private String getThemeScript() {
6565

6666
@Override
6767
public String replaceCssVariables(String html) {
68-
html = super.replaceCssVariables(html);
68+
String htmlStyled = super.replaceCssVariables(html);
6969

7070
// Replace CSS variables with actual color values
71-
html = html.replace("var(--example-line-removed-color)", super.getColorAsHex("DELETION_COLOR", "#ff0000"));
72-
html = html.replace("var(--example-line-added-color)", super.getColorAsHex("ADDITION_COLOR", "#00ff00"));
71+
htmlStyled = htmlStyled.replace("var(--example-line-removed-color)", super.getColorAsHex("DELETION_COLOR", "#ff0000"));
72+
htmlStyled = htmlStyled.replace("var(--example-line-added-color)", super.getColorAsHex("ADDITION_COLOR", "#00ff00"));
7373

74-
return html;
74+
return htmlStyled;
7575
}
7676
}

plugin/src/main/java/io/snyk/eclipse/plugin/html/HtmlProviderFactory.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
import io.snyk.eclipse.plugin.domain.ProductConstants;
44

55
public class HtmlProviderFactory {
6-
7-
public static BaseHtmlProvider GetHtmlProvider(String product)
8-
{
9-
switch (product) {
10-
case ProductConstants.DISPLAYED_CODE_SECURITY:
11-
case ProductConstants.DISPLAYED_CODE_QUALITY:
12-
return CodeHtmlProvider.getInstance();
13-
case ProductConstants.DISPLAYED_OSS:
14-
return OssHtmlProvider.getInstance();
15-
case ProductConstants.DISPLAYED_IAC:
16-
return IacHtmlProvider.getInstance();
17-
}
18-
return null;
19-
}
6+
7+
public static BaseHtmlProvider GetHtmlProvider(String product) {
8+
switch (product) {
9+
case ProductConstants.DISPLAYED_CODE_SECURITY:
10+
case ProductConstants.DISPLAYED_CODE_QUALITY:
11+
return CodeHtmlProvider.getInstance();
12+
case ProductConstants.DISPLAYED_OSS:
13+
return OssHtmlProvider.getInstance();
14+
case ProductConstants.DISPLAYED_IAC:
15+
return IacHtmlProvider.getInstance();
16+
default:
17+
return null;
18+
}
19+
}
2020
}

plugin/src/main/java/io/snyk/eclipse/plugin/preferences/LabelFieldEditor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ public LabelFieldEditor(String value, Composite parent) {
2020

2121
// Adjusts the field editor to be displayed correctly
2222
// for the given number of columns.
23+
@Override
2324
protected void adjustForNumColumns(int numColumns) {
2425
((GridData) label.getLayoutData()).horizontalSpan = numColumns;
2526
}
2627

2728
// Fills the field editor's controls into the given parent.
29+
@Override
2830
protected void doFillIntoGrid(Composite parent, int numColumns) {
2931
label = getLabelControl(parent);
3032

@@ -39,17 +41,21 @@ protected void doFillIntoGrid(Composite parent, int numColumns) {
3941
}
4042

4143
// Returns the number of controls in the field editor.
44+
@Override
4245
public int getNumberOfControls() {
4346
return 1;
4447
}
4548

4649
// Labels do not persist any preferences, so these methods are empty.
50+
@Override
4751
protected void doLoad() {
4852
}
4953

54+
@Override
5055
protected void doLoadDefault() {
5156
}
52-
57+
58+
@Override
5359
protected void doStore() {
5460
}
5561
}

plugin/src/main/java/io/snyk/eclipse/plugin/properties/FolderConfigs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public FolderConfigsParam updateFolderConfigs() {
7676

7777
for (var project : openProjects) {
7878
Path path = ResourceUtils.getFullPath(project);
79-
IScopeContext projectScope = new ProjectScope(project);
79+
IScopeContext projectScope = new ProjectScope(project); //NOPMD
8080
var projectSettings = projectScope.getNode(Activator.PLUGIN_ID);
8181
String additionalParams = projectSettings.get(ProjectPropertyPage.SNYK_ADDITIONAL_PARAMETERS, "");
8282
var additionalParamsList = Arrays.asList(additionalParams.split(" "));

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
public class ScanWorkspaceFolderHandler extends AbstractHandler {
2020

2121
@SuppressWarnings("restriction")
22+
@Override
2223
public Object execute(ExecutionEvent event) throws ExecutionException {
2324
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
2425

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010

1111
public class ScanWorkspaceMenuHandler extends AbstractHandler {
1212

13-
public Object execute(ExecutionEvent event) throws ExecutionException {
14-
CompletableFuture.runAsync(() -> {
13+
@Override
14+
public Object execute(ExecutionEvent event) throws ExecutionException {
15+
CompletableFuture.runAsync(() -> {
1516
SnykExtendedLanguageClient.getInstance().triggerScan(null);
1617
});
17-
return null;
18-
}
18+
return null;
19+
}
1920
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import io.snyk.eclipse.plugin.preferences.Preferences;
66
import io.snyk.eclipse.plugin.views.snyktoolview.TreeFilterManager;
77

8-
@SuppressWarnings("rawtypes")
8+
@SuppressWarnings({ "rawtypes", "PMD.AbstractClassWithoutAbstractMethod" })
99
public abstract class BaseFilter {
1010
protected Preferences preferences = Preferences.getInstance();
1111
protected TreeFilterManager filterManager;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
import io.snyk.eclipse.plugin.views.snyktoolview.TreeFilterManager;
2828

2929
public class BaseHandler extends AbstractHandler implements IElementUpdater, IHandlerCommands {
30-
protected ImageDescriptor iconEnabled = null;
31-
protected ImageDescriptor iconDisabled = null;
32-
protected String preferenceKey = null;
30+
protected ImageDescriptor iconEnabled;
31+
protected ImageDescriptor iconDisabled;
32+
protected String preferenceKey;
3333

3434
public BaseHandler() {
3535
iconEnabled = SnykIcons.ENABLED;

plugin/src/main/java/io/snyk/eclipse/plugin/wizards/SnykWizard.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,29 @@ public void addPages() {
4444
setNeedsProgressMonitor(true);
4545
}
4646

47+
@Override
4748
public void init(IWorkbench workbench, IStructuredSelection selection) {
4849
this.workbench = workbench;
4950
this.selection = selection;
5051
}
5152

53+
@Override
5254
public boolean canFinish() {
53-
if (this.getContainer().getCurrentPage() == authenticatePage) {
55+
if (this.getContainer().getCurrentPage().equals(authenticatePage)) {
5456
return true;
5557
}
5658
return false;
5759
}
5860

61+
@Override
5962
public boolean performCancel() {
6063
model.resetPreferences();
6164
return true;
6265
}
6366

67+
@Override
6468
public boolean performFinish() {
65-
new Job("Applying configuration from wizard...") {
69+
new Job("Applying configuration from wizard...") {
6670
@Override
6771
protected IStatus run(IProgressMonitor monitor) {
6872
monitor.beginTask("starting", 60);
@@ -84,7 +88,7 @@ protected IStatus run(IProgressMonitor monitor) {
8488
monitor.worked(20);
8589
monitor.subTask("trusting workspace folders...");
8690
var projects = ResourceUtils.getAccessibleTopLevelProjects();
87-
if (projects != null && projects.size()>0) {
91+
if (projects != null && !projects.isEmpty()) {
8892
lc.trustWorkspaceFolders();
8993
}
9094
monitor.worked(20);

0 commit comments

Comments
 (0)