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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
JavadocType: False negative for unknown tag in the format abc.xyz
#14618
Comments
Here is my thoughts on this: yes, this should be fixed. However, as you have demonstrated above, there may be commonly used "unknown tags" that we aren't placing violations on now, and this check does not seem to allow us to specify tags that should be considered "known"; so when we would release this change, it could be painful for users. Imagine you are Apache, and have something set up to generate documentation based off of the Before proceeding here, please do this:
When users visit this issue with a bunch of new violations, this will allow them to easily suppress them in their project. Also, this exercise will demonstrate that we CAN successfully suppress these violations. Sadly, we cannot use XPath for this. I will approve this issue once we can prove that suppression model is effective. |
Before proceeding, how do we feel about adding a new property Because I feel like for those cases, our users are probably setting And due to that, it is very likely that our users won't be getting any new violations, as currently supported unknown tags that are not in format |
This is a logical proposal, anyone is welcome to open issues for further discussion :) In my limited experience, I find it is easier to make incremental changes to deliver features/bug fixes to users faster and get actual feedback from a few users. If we have some reliable suppression and this is enough, then it is enough :) So, we deliver this bug fix with a suppression that can be extended to deliver functionality like Otherwise, we end up with checks with a lot of properties; extra properties typically increase the potential for bugs and maintenance overhead. Also, we want to avoid falling into the rabbit hole of perfecting things; nothing is ever perfect. |
In response to #14618 (comment). Note: Click on "鈻禜eading" to expand its contents. Test.java/**
* @ignored ok
* @checked violation
*/
public class Test {
/**
* @ignored ok
* @checked violation
*/
class Test2 {
/**
* @WignoredW violation
* @ignored ok
* @author ok
*/
static class Test3 {
static class Test4 {
/**
* @ignore violation
* @ignored ok
*/
static class Test5 {
/**
* @gnored violation
* @ignored ok
*/
enum Test6 {
}
}
record Test7() {
/**
* @ignOred violation
* @ignored ok
*/
record Test8() {
}
}
}
/**
* @checked violation
* @ignored ok
*/
interface Test9 {
}
}
/**
*
* @IGNORED violation
* @ignored ok
*/
@interface Test10 {}
/**
*
* @param ignored
*/
record Test11() {}
}
} Without Suppression:config.xml<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="TreeWalker">
<module name="JavadocType"/>
</module>
</module> CLIjava -jar checkstyle-10.14.0-all.jar -c config.xml Test.java
Starting audit...
[ERROR] Test.java:2:4: Unknown tag 'ignored'. [JavadocType]
[ERROR] Test.java:3:4: Unknown tag 'checked'. [JavadocType]
[ERROR] Test.java:7:8: Unknown tag 'ignored'. [JavadocType]
[ERROR] Test.java:8:8: Unknown tag 'checked'. [JavadocType]
[ERROR] Test.java:13:12: Unknown tag 'WignoredW'. [JavadocType]
[ERROR] Test.java:14:12: Unknown tag 'ignored'. [JavadocType]
[ERROR] Test.java:21:20: Unknown tag 'ignore'. [JavadocType]
[ERROR] Test.java:22:20: Unknown tag 'ignored'. [JavadocType]
[ERROR] Test.java:27:24: Unknown tag 'gnored'. [JavadocType]
[ERROR] Test.java:28:24: Unknown tag 'ignored'. [JavadocType]
[ERROR] Test.java:37:24: Unknown tag 'ignOred'. [JavadocType]
[ERROR] Test.java:38:24: Unknown tag 'ignored'. [JavadocType]
[ERROR] Test.java:47:16: Unknown tag 'checked'. [JavadocType]
[ERROR] Test.java:48:16: Unknown tag 'ignored'. [JavadocType]
[ERROR] Test.java:57:12: Unknown tag 'IGNORED'. [JavadocType]
[ERROR] Test.java:58:12: Unknown tag 'ignored'. [JavadocType]
[ERROR] Test.java:64:12: Unused @param tag for 'ignored'. [JavadocType]
Audit done.
Checkstyle ends with 17 errors. Suppressing violation for unknown tag
|
I am good to approve, @romani please take a look and add approved label if you are good. |
This Check is not AST based, if you start heavily test it you would never stop opening new issues and fixing them. All not AST based Checks are kind of deprecated, we should reimplement them first. We allow some updates to such Checks, that are easy and annoying users. This issue doesn't looks like bothering anyone. It is valid issue but I don't think we need fix it before refactoring/redesign. Redesign might also required, as this Checks too much validation, it is already proven to be error prone. |
I am approving this issue, I placed "Attention note from maintainers:" in issue description. |
(Documentation)
Discovered this while working on the fix for #14573
Example of such usages in real-code can be found here.
Test.java 馃悳
config.xml
attention that
allowUnknownTags
isfalse
by default.Current CLI:
Expected:
Attention note from maintainers:
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java
Lines 149 to 150 in 72cf172
this Check is not AST based, so fix might be not trivial. We can accept fix only if it is simple and does not cause more regressions or false positives. Ideally we should reimplement this Check to be ast based, example:
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheck.java
Line 110 in 72cf172
The text was updated successfully, but these errors were encountered: