Skip to content
This repository has been archived by the owner. It is now read-only.

Gradle plugin example #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Gradle plugin example #2

wants to merge 2 commits into from

Conversation

@tomasbjerre
Copy link
Owner

@tomasbjerre tomasbjerre commented Mar 4, 2016

Testing gradle plugin

@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch 2 times, most recently from 693610a to 75974d3 Mar 4, 2016
@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch 2 times, most recently from b7db765 to a1ca791 Mar 4, 2016
@tomasbjerre tomasbjerre force-pushed the master branch 2 times, most recently from 1ae9ccf to 01368c4 Mar 5, 2016
@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch from a1ca791 to d3dd10e Mar 5, 2016
@tomasbjerre tomasbjerre force-pushed the master branch 3 times, most recently from afd810b to 098e30f Mar 6, 2016
@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch 9 times, most recently from 2b05970 to a3902d4 Mar 6, 2016
@@ -12,6 +12,15 @@ void npe(String a, String b) {
a.length();
Copy link
Owner Author

@tomasbjerre tomasbjerre Mar 8, 2016

test comment 0

@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch from 10f3402 to dd09a2c Mar 8, 2016
@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch from 58ca67a to b92e6b0 Mar 25, 2016
@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch from b92e6b0 to ff59179 Mar 25, 2016
@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch from 4c33681 to 9ec6d26 Mar 26, 2016
@tomasbjerre tomasbjerre force-pushed the master branch 2 times, most recently from 6947d28 to 9409670 Oct 1, 2016
@@ -30,6 +31,6 @@ void npe2(String a, String b) {

@Override
public boolean equals(Object obj) {
return true;
return false;
}
Copy link
Owner Author

@tomasbjerre tomasbjerre Mar 31, 2019

Reporter: Findbugs
Rule: EQ_ALWAYS_TRUE
Severity: ERROR
File: se/bjurr/violations/lib/example/MyClass.java L35
Source: se.bjurr.violations.lib.example.MyClass

equals method always returns true <p> This class defines an equals method that always returns true. This is imaginative, but not very smart. Plus, it means that the equals method is not symmetric. </p>

@@ -30,6 +31,6 @@ void npe2(String a, String b) {

@Override
public boolean equals(Object obj) {
return true;
return false;
}
Copy link
Owner Author

@tomasbjerre tomasbjerre Mar 31, 2019

Reporter: Findbugs
Rule: HE_EQUALS_USE_HASHCODE
Severity: WARN
File: se/bjurr/violations/lib/example/MyClass.java L35
Source: se.bjurr.violations.lib.example.MyClass

Class defines equals() and uses Object.hashCode() <p> This class overrides <code>equals(Object)</code>, but does not override <code>hashCode()</code>, and inherits the implementation of <code>hashCode()</code> from <code>java.lang.Object</code> (which returns the identity hash code, an arbitrary value assigned to the object by the VM).&nbsp; Therefore, the class is very likely to violate the invariant that equal objects must have equal hashcodes.</p> <p>If you don't think instances of this class will ever be inserted into a HashMap/HashTable, the recommended <code>hashCode</code> implementation to use is:</p> <pre>public int hashCode() { assert false : "hashCode not designed"; return 42; // any arbitrary constant will do }</pre>

@@ -30,6 +31,6 @@ void npe2(String a, String b) {
Copy link
Owner Author

@tomasbjerre tomasbjerre Mar 31, 2019

Reporter: Findbugs
Rule: NP_ALWAYS_NULL
Severity: ERROR
File: se/bjurr/violations/lib/example/MyClass.java L13
Source: se.bjurr.violations.lib.example.MyClass

Null pointer dereference <p> A null pointer is dereferenced here.&nbsp; This will lead to a <code>NullPointerException</code> when the code is executed.</p>

@@ -30,6 +31,6 @@ void npe2(String a, String b) {
Copy link
Owner Author

@tomasbjerre tomasbjerre Mar 31, 2019

Reporter: Findbugs
Rule: NP_LOAD_OF_KNOWN_NULL_VALUE
Severity: INFO
File: se/bjurr/violations/lib/example/MyClass.java L13
Source: se.bjurr.violations.lib.example.MyClass

Load of known null value <p> The variable referenced at this point is known to be null due to an earlier check against null. Although this is valid, it might be a mistake (perhaps you intended to refer to a different variable, or perhaps the earlier check to see if the variable is null should have been a check to see if it was non-null). </p>

@@ -6,6 +6,7 @@
void npe(String a, String b) {
if (a == null) {
System.out.println();
System.out.println();
Copy link
Owner Author

@tomasbjerre tomasbjerre Jun 16, 2019

Reporter: Checkstyle
Rule: com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck
Severity: INFO
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L9

Must have at least one statement.

@@ -30,6 +31,6 @@ void npe2(String a, String b) {

@Override
public boolean equals(Object obj) {
return true;
return false;
Copy link
Owner Author

@tomasbjerre tomasbjerre Jun 16, 2019

Reporter: PMD
Rule: OverrideBothEqualsAndHashcode
Severity: WARN
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L34

Ensure you override both equals() and hashCode() Basic https://pmd.github.io/pmd-5.6.1/pmd-java/rules/java/basic.html#OverrideBothEqualsAndHashcode

@tomasbjerre
Copy link
Owner Author

@tomasbjerre tomasbjerre commented Jun 16, 2019

Found 17 violations:

Reporter: Checkstyle
Rule: com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck
Severity: ERROR
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L0

Missing package-info.java file.


Reporter: Checkstyle
Rule: com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck
Severity: INFO
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L9

Must have at least one statement.


Reporter: Checkstyle
Rule: com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck
Severity: INFO
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L27

Must have at least one statement.


Reporter: Checkstyle
Rule: com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck
Severity: INFO
File: /home/bjerre/Hämtningar/workspace/pipe/src/main/java/se/bjurr/violations/lib/example/OtherClass.java L10

Must have at least one statement.


Reporter: Checkstyle
Rule: com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck
Severity: INFO
File: /home/bjerre/Hämtningar/workspace/pipe/src/main/java/se/bjurr/violations/lib/example/OtherClass.java L13

Must have at least one statement.


Reporter: Checkstyle
Rule: com.puppycrawl.tools.checkstyle.checks.metrics.BooleanExpressionComplexityCheck
Severity: WARN
File: /home/bjerre/Hämtningar/workspace/pipe/src/main/java/se/bjurr/violations/lib/example/OtherClass.java L29

Boolean expression complexity is 8 (max allowed is 1).


Reporter: Checkstyle
Rule: com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck
Severity: ERROR
File: /home/bjerre/Hämtningar/workspace/pipe/src/test/java/se/bjurr/violations/lib/example/MyClassTest.java L0

Missing package-info.java file.


Reporter: Findbugs
Rule: EQ_ALWAYS_TRUE
Severity: ERROR
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L35
Source: se.bjurr.violations.lib.example.MyClass

equals method always returns true <p> This class defines an equals method that always returns true. This is imaginative, but not very smart. Plus, it means that the equals method is not symmetric. </p>


Reporter: Findbugs
Rule: HE_EQUALS_USE_HASHCODE
Severity: WARN
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L35
Source: se.bjurr.violations.lib.example.MyClass

Class defines equals() and uses Object.hashCode() <p> This class overrides <code>equals(Object)</code>, but does not override <code>hashCode()</code>, and inherits the implementation of <code>hashCode()</code> from <code>java.lang.Object</code> (which returns the identity hash code, an arbitrary value assigned to the object by the VM).&nbsp; Therefore, the class is very likely to violate the invariant that equal objects must have equal hashcodes.</p> <p>If you don't think instances of this class will ever be inserted into a HashMap/HashTable, the recommended <code>hashCode</code> implementation to use is:</p> <pre>public int hashCode() { assert false : "hashCode not designed"; return 42; // any arbitrary constant will do }</pre>


Reporter: Findbugs
Rule: NP_ALWAYS_NULL
Severity: ERROR
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L13
Source: se.bjurr.violations.lib.example.MyClass

Null pointer dereference <p> A null pointer is dereferenced here.&nbsp; This will lead to a <code>NullPointerException</code> when the code is executed.</p>


Reporter: Findbugs
Rule: NP_LOAD_OF_KNOWN_NULL_VALUE
Severity: INFO
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L13
Source: se.bjurr.violations.lib.example.MyClass

Load of known null value <p> The variable referenced at this point is known to be null due to an earlier check against null. Although this is valid, it might be a mistake (perhaps you intended to refer to a different variable, or perhaps the earlier check to see if the variable is null should have been a check to see if it was non-null). </p>


Reporter: Findbugs
Rule: NP_NULL_ON_SOME_PATH
Severity: ERROR
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L26
Source: se.bjurr.violations.lib.example.MyClass

Possible null pointer dereference <p> There is a branch of statement that, <em>if executed,</em> guarantees that a null value will be dereferenced, which would generate a <code>NullPointerException</code> when the code is executed. Of course, the problem might be that the branch or statement is infeasible and that the null pointer exception can't ever be executed; deciding that is beyond the ability of FindBugs. </p>


Reporter: Findbugs
Rule: MS_SHOULD_BE_FINAL
Severity: INFO
File: se/bjurr/violations/lib/example/OtherClass.java L7
Source: se.bjurr.violations.lib.example.OtherClass

Field isn't final but should be <p> This static field public but not final, and could be changed by malicious code or by accident from another package. The field could be made final to avoid this vulnerability.</p>


Reporter: Findbugs
Rule: NM_FIELD_NAMING_CONVENTION
Severity: INFO
File: se/bjurr/violations/lib/example/OtherClass.java L6
Source: se.bjurr.violations.lib.example.OtherClass

Field names should start with a lower case letter <p> Names of fields that are not final should be in mixed case with a lowercase first letter and the first letters of subsequent words capitalized. </p>


Reporter: Findbugs
Rule: UC_USELESS_VOID_METHOD
Severity: INFO
File: se/bjurr/violations/lib/example/OtherClass.java L16
Source: se.bjurr.violations.lib.example.OtherClass

Useless non-empty void method <p>Our analysis shows that this non-empty void method does not actually perform any useful work. Please check it: probably there's a mistake in its code or its body can be fully removed. </p> <p>We are trying to reduce the false positives as much as possible, but in some cases this warning might be wrong. Common false-positive cases include:</p> <p>- The method is intended to trigger loading of some class which may have a side effect.</p> <p>- The method is intended to implicitly throw some obscure exception.</p>


Reporter: PMD
Rule: OverrideBothEqualsAndHashcode
Severity: WARN
File: src/main/java/se/bjurr/violations/lib/example/MyClass.java L34

Ensure you override both equals() and hashCode() Basic https://pmd.github.io/pmd-5.6.1/pmd-java/rules/java/basic.html#OverrideBothEqualsAndHashcode


Reporter: PMD
Rule: OverrideBothEqualsAndHashcode
Severity: WARN
File: /home/bjerre/Hämtningar/workspace/pipe/src/main/java/se/bjurr/violations/lib/example/OtherClass.java L19

Ensure you override both equals() and hashCode() Basic https://pmd.github.io/pmd-5.6.1/pmd-java/rules/java/basic.html#OverrideBothEqualsAndHashcode


Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant