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
Issue #6241: resolved teamcity 2018.3 violations #6242
Conversation
src/main/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessage.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.
item to improve:
src/main/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessage.java
Outdated
Show resolved
Hide resolved
@rnveach , I think it is reasonable to suppress complicated cases and resolve them later on. |
I am working through what I can and suppressing the rest.
I am not finding this in the local intellij to disable. I don't know inspection name.
These are already suppressed but the new version seems to be ignoring the suppression so I am not sure what to do. |
This should be
Again, this is |
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 do not add more fixes to this PR, lets merge this PR quicker
items to improve:
config/intellij-idea-inspections.xml
Outdated
@@ -1136,7 +1136,8 @@ | |||
enabled_by_default="true"/> | |||
<inspection_tool class="ClassOnlyUsedInOneModule" enabled="true" level="ERROR" | |||
enabled_by_default="true"/> | |||
<inspection_tool class="ClassOnlyUsedInOnePackage" enabled="true" level="ERROR" | |||
<!-- packages should be where we define them. --> |
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.
in library project ...... other projects might use it.
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.
Are you saying you want me to enable this but just use noinspection suppressions?
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.
No, keep disabled but update wording as I proposed
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.
Done.
config/intellij-idea-inspections.xml
Outdated
enabled_by_default="true"/> | ||
enabled_by_default="true"> | ||
<!-- is still provides valuable information to programmer --> | ||
<option name="REPORT_INACCESSIBLE" value="false" /> |
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.
I am not agree here a bit.
current violations:
Declaration has problems in Javadoc references
AbstractJavadocCheck
Symbol 'firstNonTightHtmlTag' is inaccessible from here
UniquePropertiesCheckTest
Symbol 'getLineNumber(FileText, String)' is inaccessible from here
Symbol 'firstNonTightHtmlTag' is inaccessible from here
it is not reasonable to provide link to private field. Second link in this javadoc is valid and only it should be present.
it gives enough context for user. link to private field is not required.
Symbol 'getLineNumber(FileText, String)' is inaccessible from here
we need to do suppression of this case, usage of reflection in tests is hack and it is a problem of test, javadoc over test should explain all, and it will contain suppression and explanation of suppression. It is good practice to allow hacks but force engineer to provide a lot of documentation/suppressions to show that it is not easy way :) .
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.
Done.
config/intellij-idea-inspections.xml
Outdated
@@ -3409,6 +3413,9 @@ | |||
<inspection_tool class="OnDemandImport" enabled="true" level="ERROR" enabled_by_default="true"/> | |||
<inspection_tool class="OneWayWebMethod" enabled="false" level="WARNING" | |||
enabled_by_default="false"/> | |||
<!-- whole purpose of optional is that it may not always be present --> | |||
<inspection_tool class="OptionalGetWithoutIsPresent" enabled="false" level="ERROR" | |||
enabled_by_default="false" /> |
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.
not good.
Optional.get() is called without isPresent() check
PackageObjectFactory
'Optional.get()' without 'isPresent()' check
TokenUtilTest
'Optional.get()' without 'isPresent()' check
This is design problem and/or misusage/illusion of Optional class, without such check for presence , there will be exception - https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html#get-- .
Solution is smth like - https://stackoverflow.com/a/38725479
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.
PackageObjectFactory
Code is .get().getKey()
so we can't just return null
either. Also, this code is wrapped by containsValue
of the same list, so I highly doubt an if/else check would pass code coverage.
I think we should suppress this, you agree?
Other class was fixed.
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 suppression by separate our issue, we will discuss it separately.
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.
I can confirm code coverage won't be satisfied, but I think I see a way to rewrite the code.
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.
@romani I rewrote the code. We basically rewrote the containsValue
twice by different means, so I removed the main one and now we just rely on the one using optional.
config/intellij-idea-inspections.xml
Outdated
<!-- unstable doesn't mean it isn't safe to use, just might | ||
change between versions and isn't stable --> | ||
<inspection_tool class="UnstableApiUsage" enabled="false" level="ERROR" | ||
enabled_by_default="false" /> |
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.
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.
Done.
pom.xml
Outdated
@@ -835,7 +835,7 @@ | |||
<exclude>com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel*</exclude> | |||
<exclude>com.puppycrawl.tools.checkstyle.gui.TreeTableCellRenderer*</exclude> | |||
<exclude>com.puppycrawl.tools.checkstyle.gui.TreeTableModelAdapter*</exclude> | |||
<!-- Deprecated classes --> | |||
<!-- suppress XmlDeprecatedElement Deprecated classes --> |
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.
from inspection description:
This inspection checks for deprecated XML elements. The elements can be marked by XML comment or documentation tag with text "deprecated".
new comment looks very weird. If inspection do not like just a word "deprecated",
lets make comment <!-- This class in is deprecation phase -->
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.
Done.
@@ -165,6 +165,8 @@ private ConfigurationLoader(final PropertyResolver overrideProps, | |||
/** | |||
* Creates mapping between local resources and dtd ids. | |||
* @return map between local resources and dtd ids. | |||
* @noinspection MethodOnlyUsedFromInnerClass method must be static, | |||
* and inner class isn't static |
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.
inspections do not support definition of reason of suppress, in tag @noinspection
there should be only list of inspection names.
method must be static, and inner class isn't static
should be moved to javadoc description. Method is private, it will not be visible in HTML.
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.
Done.
I just made it a new sentence. Let me know if you want it documented another way.
@@ -471,7 +473,7 @@ public static Configuration loadConfiguration(InputSource configSource, | |||
* @throws CheckstyleException if the string contains an opening | |||
* {@code ${} without a closing | |||
* {@code }} | |||
* @noinspection MethodWithMultipleReturnPoints | |||
* @noinspection MethodWithMultipleReturnPoints, MethodOnlyUsedFromInnerClass |
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 place reason of suppress to javadoc description, sad that I already missed this for another suppression.
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.
Done.
@@ -283,6 +283,10 @@ public LocalizedMessage( | |||
sourceClass, customMessage); | |||
} | |||
|
|||
/** | |||
* Indicates whether some other object is "equal to" this one. | |||
* @noinspection EqualsCalledOnEnumConstant |
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.
we need to explain suppressions in javadoc, unfortunate side effect.
We always keep brief reason of suppression in code or to keep link to web, with detailed explanation. unfortunately here we will damage a big our javadoc, but is better than keep such explanation in code
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.
Done.
@@ -290,6 +290,10 @@ protected Suppression( | |||
} | |||
} | |||
|
|||
/** | |||
* Indicates whether some other object is "equal to" this one. | |||
* @noinspection EqualsCalledOnEnumConstant |
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.
reason of suppression to javdoc descrition
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.
Done.
@@ -414,6 +414,10 @@ public int compareTo(Tag object) { | |||
return result; | |||
} | |||
|
|||
/** | |||
* Indicates whether some other object is "equal to" this one. | |||
* @noinspection EqualsCalledOnEnumConstant |
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.
reason of suppression to javdoc descrition
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.
Done.
@rnveach, I merged few PRs with suppressions for cases that you are not sure, 2 issues were raised against inspections. |
Please rebase to resolve other issues. |
@romani rebased and fixed all issues. |
Only TC violations left are |
Is TC issue, let's wait for support reply.
Need to be addressed or suppressed. It is the same as others not working suppressions, we are to disable inspection. |
Issue #6241
These are the ones I know can be fixed. Most others will need suppressions. I'm not sure
Control flow issues - Simplifiable boolean expression (1)
is wise because of pitest.