-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Issue #14945: new check UnnecessaryNullCheckWithInstanceOf #16489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@romani unexpected output: C:\Users\anmol\IdeaProjects\checkstyle3\src\it\resources\
org\checkstyle\suppressionxpathfilter\unnecessarynullwithinstanceof\
InputXpathUnnecessaryNullCheckWithInstanceOf.java:5:13: Unnecessary nullity check with instanceof operator.
expected: 0
but was : 1
Expected :0
Actual :1
<Click to see difference> The Xpath test is failing, do i need to configure something related to the new check . It seems like the XPath query isn't suppressing the violation, causing it to be flagged at: verify(treeWalkerConfigWithXpath, fileToProcess.getPath(), CommonUtil.EMPTY_STRING_ARRAY); please have a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
items:
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...hecks/coding/unnecessarynullcheckwithinstanceof/InputUnnecessaryNullCheckWithInstanceOf.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep resolving all CI redness.
items:
...checkstyle/suppressionxpathfilter/XpathRegressionUnnecessaryNullCheckWithInstanceOfTest.java
Show resolved
Hide resolved
3a60e0c
to
a801670
Compare
923ef37
to
50ec692
Compare
@romani all CI is green, please review |
Just use google, we do not have any maintainers that can read or write these |
thanks @nrmancuso |
e8b4fb3
to
f324a11
Compare
@mahfouz72 , as this is your issue please be welcome to review first. |
@Anmol202005 , please read on how to do regression testing for new modules we need report of how it works in wild reallife code. |
github, generate site |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Few items:
src/main/resources/com/puppycrawl/tools/checkstyle/checks/coding/messages.properties
Outdated
Show resolved
Hide resolved
src/main/resources/com/puppycrawl/tools/checkstyle/checks/coding/messages_es.properties
Outdated
Show resolved
Hide resolved
...m/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheckTest.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...m/puppycrawl/tools/checkstyle/checks/coding/unnecessarynullcheckwithinstanceof/Example1.java
Outdated
Show resolved
Hide resolved
806dd59
to
e99d147
Compare
Github, generate report |
GitHub, generate website |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Items
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Items
...m/puppycrawl/tools/checkstyle/checks/coding/unnecessarynullcheckwithinstanceof/Example1.java
Show resolved
Hide resolved
...m/puppycrawl/tools/checkstyle/checks/coding/unnecessarynullcheckwithinstanceof/Example1.java
Outdated
Show resolved
Hide resolved
...m/puppycrawl/tools/checkstyle/checks/coding/unnecessarynullcheckwithinstanceof/Example1.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Items
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
f2be459
to
1abfd1e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
items:
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Show resolved
Hide resolved
based on #16489 (comment) please send PRs to following projects (you can send updates to any other projects too): to prove that people are welcoming such updates, and validations is correct. and eventual auto-fix will be well welcomed also. |
73b47e0
to
fdc3659
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last:
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Show resolved
Hide resolved
a333484
to
0eec961
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last:
...hecks/coding/unnecessarynullcheckwithinstanceof/InputUnnecessaryNullCheckWithInstanceOf.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very last:
...a/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryNullCheckWithInstanceOfCheck.java
Outdated
Show resolved
Hide resolved
0eec961
to
ac0d5f4
Compare
ac0d5f4
to
bbae580
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job!
we will merge after CI pass.
fixes #14945
New module config: https://gist.githubusercontent.com/Anmol202005/682f29f02f13ab7d347ce269901b8e5c/raw/81e58cd3889446580d12ed949ebcf1fb3f726777/check.xml
Contribution PR: checkstyle/contribution#925