Skip to content
This repository was archived by the owner on Jun 9, 2021. It is now read-only.

Gradle plugin example#2

Open
tomasbjerre wants to merge 2 commits intomasterfrom
gradle-plugin-example
Open

Gradle plugin example#2
tomasbjerre wants to merge 2 commits intomasterfrom
gradle-plugin-example

Conversation

@tomasbjerre
Copy link
Copy Markdown
Owner

Testing gradle plugin

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test comment 0

@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch from 10f3402 to dd09a2c Compare March 8, 2016 21:39
@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch from 58ca67a to b92e6b0 Compare March 25, 2016 09:49
@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch from b92e6b0 to ff59179 Compare March 25, 2016 09:54
@tomasbjerre tomasbjerre force-pushed the gradle-plugin-example branch from 4c33681 to 9ec6d26 Compare March 26, 2016 17:04
@tomasbjerre tomasbjerre force-pushed the master branch 2 times, most recently from 6947d28 to 9409670 Compare October 1, 2016 13:14
public boolean equals(Object obj) {
return true;
return false;
}
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

void npe(String a, String b) {
if (a == null) {
System.out.println();
System.out.println();
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy Markdown
Owner Author

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

Development

Successfully merging this pull request may close these issues.

1 participant