feat: summary panel [IDE-892] #771
Annotations
15 errors and 10 warnings
build (ubuntu-latest)
Process completed with exit code 1.
|
Class contains multiple getInstance methods. Please review.:
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L15
Some classes contain overloaded getInstance. The problem with overloaded getInstance methods
is that the instance created using the overloaded method is not cached and so,
for each call and new objects will be created for every invocation.
SingleMethodSingleton (Priority: 2, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#singlemethodsingleton
|
getInstance method always creates a new object and hence does not comply to Singleton Design Pattern behaviour. Please review:
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L26
A singleton class should only ever have one instance. Failure to check
whether an instance has already been created may result in multiple
instances being created.
SingletonClassReturningNewInstance (Priority: 2, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#singletonclassreturningnewinstance
|
Overridable method called during object construction: Preferences.getPref(String) :
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L81
Reports calls to overridable methods on `this` during object initialization. These
are invoked on an incompletely constructed object and can be difficult to debug if overridden.
This is because the subclass usually assumes that the superclass is completely initialized
in all methods. If that is not the case, bugs can appear in the constructor, for instance,
some fields that are still null may cause a NullPointerException or be stored somewhere
else to blow up later.
To avoid this problem, only use methods that are static, private, or final in constructors.
Note that those methods also must not call overridable methods transitively to be safe.
ConstructorCallsOverridableMethod (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod
|
Overridable method called during object construction: Preferences.store(String, String) :
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L82
Reports calls to overridable methods on `this` during object initialization. These
are invoked on an incompletely constructed object and can be difficult to debug if overridden.
This is because the subclass usually assumes that the superclass is completely initialized
in all methods. If that is not the case, bugs can appear in the constructor, for instance,
some fields that are still null may cause a NullPointerException or be stored somewhere
else to blow up later.
To avoid this problem, only use methods that are static, private, or final in constructors.
Note that those methods also must not call overridable methods transitively to be safe.
ConstructorCallsOverridableMethod (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod
|
Overridable method called during object construction: Preferences.getPref(String) :
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L84
Reports calls to overridable methods on `this` during object initialization. These
are invoked on an incompletely constructed object and can be difficult to debug if overridden.
This is because the subclass usually assumes that the superclass is completely initialized
in all methods. If that is not the case, bugs can appear in the constructor, for instance,
some fields that are still null may cause a NullPointerException or be stored somewhere
else to blow up later.
To avoid this problem, only use methods that are static, private, or final in constructors.
Note that those methods also must not call overridable methods transitively to be safe.
ConstructorCallsOverridableMethod (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod
|
Overridable method called during object construction: Preferences.store(String, String) :
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L85
Reports calls to overridable methods on `this` during object initialization. These
are invoked on an incompletely constructed object and can be difficult to debug if overridden.
This is because the subclass usually assumes that the superclass is completely initialized
in all methods. If that is not the case, bugs can appear in the constructor, for instance,
some fields that are still null may cause a NullPointerException or be stored somewhere
else to blow up later.
To avoid this problem, only use methods that are static, private, or final in constructors.
Note that those methods also must not call overridable methods transitively to be safe.
ConstructorCallsOverridableMethod (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod
|
Overridable method called during object construction: Preferences.getPref(String) :
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L87
Reports calls to overridable methods on `this` during object initialization. These
are invoked on an incompletely constructed object and can be difficult to debug if overridden.
This is because the subclass usually assumes that the superclass is completely initialized
in all methods. If that is not the case, bugs can appear in the constructor, for instance,
some fields that are still null may cause a NullPointerException or be stored somewhere
else to blow up later.
To avoid this problem, only use methods that are static, private, or final in constructors.
Note that those methods also must not call overridable methods transitively to be safe.
ConstructorCallsOverridableMethod (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod
|
Overridable method called during object construction: Preferences.store(String, String) :
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L88
Reports calls to overridable methods on `this` during object initialization. These
are invoked on an incompletely constructed object and can be difficult to debug if overridden.
This is because the subclass usually assumes that the superclass is completely initialized
in all methods. If that is not the case, bugs can appear in the constructor, for instance,
some fields that are still null may cause a NullPointerException or be stored somewhere
else to blow up later.
To avoid this problem, only use methods that are static, private, or final in constructors.
Note that those methods also must not call overridable methods transitively to be safe.
ConstructorCallsOverridableMethod (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod
|
Overridable method called during object construction: Preferences.getPref(String) :
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L90
Reports calls to overridable methods on `this` during object initialization. These
are invoked on an incompletely constructed object and can be difficult to debug if overridden.
This is because the subclass usually assumes that the superclass is completely initialized
in all methods. If that is not the case, bugs can appear in the constructor, for instance,
some fields that are still null may cause a NullPointerException or be stored somewhere
else to blow up later.
To avoid this problem, only use methods that are static, private, or final in constructors.
Note that those methods also must not call overridable methods transitively to be safe.
ConstructorCallsOverridableMethod (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod
|
Overridable method called during object construction: Preferences.store(String, String) :
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L91
Reports calls to overridable methods on `this` during object initialization. These
are invoked on an incompletely constructed object and can be difficult to debug if overridden.
This is because the subclass usually assumes that the superclass is completely initialized
in all methods. If that is not the case, bugs can appear in the constructor, for instance,
some fields that are still null may cause a NullPointerException or be stored somewhere
else to blow up later.
To avoid this problem, only use methods that are static, private, or final in constructors.
Note that those methods also must not call overridable methods transitively to be safe.
ConstructorCallsOverridableMethod (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod
|
build (windows-latest)
The job was canceled because "ubuntu-latest" failed.
|
build (windows-latest)
The operation was canceled.
|
build (macos-latest)
The job was canceled because "ubuntu-latest" failed.
|
build (macos-latest)
The operation was canceled.
|
Position literals first in String comparisons:
plugin/src/main/java/io/snyk/eclipse/plugin/html/BaseHtmlProvider.java#L153
Position literals first in all String comparisons, if the second argument is null then NullPointerExceptions
can be avoided, they will just return false. Note that switching literal positions for compareTo and
compareToIgnoreCase may change the result, see examples.
LiteralsFirstInComparisons (Priority: 3, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_bestpractices.html#literalsfirstincomparisons
|
Field store has the same name as a method:
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L77
It can be confusing to have a field name with the same name as a method. While this is permitted,
having information (field) and actions (method) is not clear naming. Developers versed in
Smalltalk often prefer this approach as the methods denote accessor methods.
AvoidFieldNameMatchingMethodName (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#avoidfieldnamematchingmethodname
|
The String literal "false" appears 8 times in this file; the first occurrence is on line 82:
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L82
Code containing duplicate String literals can usually be improved by declaring the String as a constant field.
AvoidDuplicateLiterals (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#avoidduplicateliterals
|
The String literal "true" appears 12 times in this file; the first occurrence is on line 88:
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L88
Code containing duplicate String literals can usually be improved by declaring the String as a constant field.
AvoidDuplicateLiterals (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#avoidduplicateliterals
|
Consider using varargs for methods or constructors which take an array the last parameter.:
plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/BaseBranchDialog.java#L28
Java 5 introduced the varargs parameter declaration for methods and constructors. This syntactic
sugar provides flexibility for users of these methods and constructors, allowing them to avoid
having to deal with the creation of an array.
Byte arrays in any method and String arrays in `public static void main(String[])` methods are ignored.
UseVarargs (Priority: 4, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_bestpractices.html#usevarargs
|
Avoid using literals in if statements:
plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/BrowserHandler.java#L48
Avoid using hard-coded literals in conditional statements. By declaring them as static variables
or private members with descriptive names maintainability is enhanced. By default, the literals "-1" and "0" are ignored.
More exceptions can be defined with the property "ignoreMagicNumbers".
The rule doesn't consider deeper expressions by default, but this can be enabled via the property `ignoreExpressions`.
With this property set to false, if-conditions like `i == 1 + 5` are reported as well. Note that in that case,
the property ignoreMagicNumbers is not taken into account, if there are multiple literals involved in such an expression.
AvoidLiteralsInIfCondition (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#avoidliteralsinifcondition
|
The initializer for variable 'product' is never used (overwritten on lines 170 and 172):
plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/BrowserHandler.java#L168
Reports assignments to variables that are never used before the variable is overwritten,
or goes out of scope. Unused assignments are those for which
1. The variable is never read after the assignment, or
2. The assigned value is always overwritten by other assignments before the next read of
the variable.
The rule tracks assignements to fields of `this`, and static fields of the current class.
This may cause some false positives in timing-sensitive concurrent code, which the rule cannot detect.
The rule may be suppressed with the standard `@SuppressWarnings("unused")` tag.
The rule subsumes {% rule "UnusedLocalVariable" %}, and {% rule "UnusedFormalParameter" %}.
Those violations are filtered
out by default, in case you already have enabled those rules, but may be enabled with the property
`reportUnusedVariables`. Variables whose name starts with `ignored` or `unused` are filtered out, as
is standard practice for exceptions.
Limitations:
* The rule currently cannot know which method calls throw exceptions, or which exceptions they throw.
In the body of a try block, every method or constructor call is assumed to throw. This may cause false-negatives.
The only other language construct that is assumed to throw is the `throw` statement, in particular,
things like `assert` statements, or NullPointerExceptions on dereference are ignored.
* The rule cannot resolve assignments across constructors, when they're called with the special
`this(...)` syntax. This may cause false-negatives.
Both of those limitations may be partly relaxed in PMD 7.
UnusedAssignment (Priority: 3, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_bestpractices.html#unusedassignment
|
Switch statements or expressions should be exhaustive, add a default case (or missing enum branches):
plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/ProductTreeNode.java#L24
Switch statements should be exhaustive, to make their control flow
easier to follow. This can be achieved by adding a `default` case, or,
if the switch is on an enum type, by ensuring there is one switch branch
for each enum constant.
This rule doesn't consider Switch Statements, that use Pattern Matching, since for these the
compiler already ensures that all cases are covered. The same is true for Switch Expressions,
which are also not considered by this rule.
NonExhaustiveSwitch (Priority: 3, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_bestpractices.html#nonexhaustiveswitch
|
Avoid using redundant field initializer for 'instance':
plugin/src/main/java/io/snyk/languageserver/protocolextension/SnykExtendedLanguageClient.java#L115
Java will initialize fields with known default values so any explicit initialization of those same defaults
is redundant and results in a larger class file (approximately three additional bytecode instructions per field).
RedundantFieldInitializer (Priority: 3, Ruleset: Performance)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_performance.html#redundantfieldinitializer
|
Possible unsafe assignment to non-final static field 'instance' in a constructor.:
plugin/src/main/java/io/snyk/languageserver/protocolextension/SnykExtendedLanguageClient.java#L119
Identifies a possible unsafe usage of a static field.
AssignmentToNonFinalStatic (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.9.0/pmd_rules_java_errorprone.html#assignmenttononfinalstatic
|
Artifacts
Produced during runtime
Name | Size | |
---|---|---|
PMD Report
|
5.14 KB |
|