Skip to content
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

JavadocType: False negative for unknown tag with no description #14573

Open
sktpy opened this issue Feb 29, 2024 · 2 comments · May be fixed by #14882
Open

JavadocType: False negative for unknown tag with no description #14573

sktpy opened this issue Feb 29, 2024 · 2 comments · May be fixed by #14882

Comments

@sktpy
Copy link
Contributor

sktpy commented Feb 29, 2024

(Documentation)

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>

Test.java

/**
 * @val
 */
class Test {}

Current CLI:

java -jar checkstyle-10.14.0-all.jar -c config.xml Test.java
Starting audit...
Audit done.

Expected:

[ERROR] Test.java:2:4: Unknown tag 'val'. [JavadocType]

Explanation:

  • val is an unknown tag (allowUnknownTags by default is false), and hence should produce a violation.
  • Note that this false negative only occurs when the tag is not accompanied by any description, violation is produced as expected when the unknown tag is associated with description.

Attention note from maintainers:

public class JavadocTypeCheck
extends AbstractCheck {

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:
public class AtclauseOrderCheck extends AbstractJavadocCheck {

@sktpy
Copy link
Contributor Author

sktpy commented Feb 29, 2024

Example showing that violation is produced as expected if the unknown tag is with the description. (same config is used)

Test.java

/**
 * @val well well well, how the turntables
 */
class Test {}

CLI: [ERROR] Test.java:2:4: Unknown tag 'val'. [JavadocType]

@sktpy sktpy changed the title False negative for JavadocType JavadocType: False negative for unknown tag with no description Mar 1, 2024
@sktpy
Copy link
Contributor Author

sktpy commented Mar 8, 2024

Resolution on #14618 is required so that I can decide on how to proceed with this issue.

@checkstyle checkstyle deleted a comment from sktpy Apr 23, 2024
@checkstyle checkstyle deleted a comment from nrmancuso Apr 23, 2024
@checkstyle checkstyle deleted a comment from sktpy Apr 23, 2024
@romani romani added the javadoc label Apr 23, 2024
strkkk added a commit to strkkk/checkstyle that referenced this issue May 17, 2024
@strkkk strkkk linked a pull request May 17, 2024 that will close this issue
strkkk added a commit to strkkk/checkstyle that referenced this issue May 17, 2024
strkkk added a commit to strkkk/checkstyle that referenced this issue May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants