From b167797ef03e9ef5bbf0de24b4337d7e808dc77f Mon Sep 17 00:00:00 2001 From: Mohanad Date: Sat, 2 Nov 2024 01:57:12 +0200 Subject: [PATCH] Issue #11584: WriteTag reports violation with confusing message when there is no javadoc --- config/jsoref-spellchecker/whitelist.words | 1 + .../checks/javadoc/WriteTagCheck.java | 6 +- .../meta/checks/javadoc/WriteTagCheck.xml | 1 + .../checks/javadoc/WriteTagCheckTest.java | 99 +++++++++++++++++-- .../InputWriteTagRecordsAndCompactCtors.java | 10 +- .../writetag/InputWriteTagNoJavadoc.java | 2 +- .../writetag/InputWriteTagResetSeverity.java | 32 ++++++ .../checks/javadoc/writetag/Example1.txt | 2 + .../checks/javadoc/writetag/Example2.txt | 2 + .../checks/javadoc/writetag/Example3.txt | 2 + .../checks/javadoc/writetag/Example4.txt | 2 + src/xdocs/checks/javadoc/writetag.xml | 9 ++ .../checks/javadoc/writetag.xml.template | 1 + 13 files changed, 151 insertions(+), 18 deletions(-) create mode 100644 src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/writetag/InputWriteTagResetSeverity.java diff --git a/config/jsoref-spellchecker/whitelist.words b/config/jsoref-spellchecker/whitelist.words index 61869c514be..b4635841172 100644 --- a/config/jsoref-spellchecker/whitelist.words +++ b/config/jsoref-spellchecker/whitelist.words @@ -840,6 +840,7 @@ mockit mockito modifiedcontrolvariable modifierorder +Mohanad Mohnen mojohaus moks diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java index 7e520888580..735ffc211ef 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java @@ -36,6 +36,7 @@ * Requires user defined Javadoc tag to be present in Javadoc comment with defined format. * To define the format for a tag, set property tagFormat to a regular expression. * Property tagSeverity is used for severity of events when the tag exists. + * No violation reported in case there is no javadoc. * * *