-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Issue #15685: fixed JavadocParagraph to detect paragraph tag when they have their corresponding closing tag #15686
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
c88060a to
c23ec48
Compare
|
I have set the though there are still following errors in the build failure: Locally I tried to fix /**
* Tests whether the paragraph tag is misplaced.
* Meaning that it is not immediate before the first word or another tag.
*
* @param tag html tag.
* @return true, if the paragraph tag is misplaced.
*/
private boolean isMisplacedParagraph(DetailNode tag) {
boolean shouldGiveViolation;
if (allowNewlineParagraph) {
shouldGiveViolation = false;
}
else if (JavadocUtil.getFirstChild(tag).getType() == JavadocTokenTypes.PARAGRAPH) {
final DetailNode paragraphToken = JavadocUtil.getFirstChild(tag);
final DetailNode paragraphStartTagToken = JavadocUtil.getFirstChild(paragraphToken);
final DetailNode nextSibling = JavadocUtil.getNextSibling(paragraphStartTagToken);
shouldGiveViolation = nextSibling.getType() == JavadocTokenTypes.NEWLINE
|| nextSibling.getType() == JavadocTokenTypes.EOF
|| nextSibling.getText().startsWith(" ");
}
else {
final DetailNode nextSibling = JavadocUtil.getNextSibling(tag);
shouldGiveViolation = nextSibling.getType() == JavadocTokenTypes.NEWLINE
|| nextSibling.getType() == JavadocTokenTypes.EOF
|| nextSibling.getText().startsWith(" ");
}
return shouldGiveViolation;
} /**
* Determines whether or not the line with paragraph tag has previous empty line.
*
* @param tag html tag.
*/
private void checkParagraphTag(DetailNode tag) {
final DetailNode newLine = getNearestEmptyLine(tag);
if (isFirstParagraph(tag)) {
log(tag.getLineNumber(), MSG_REDUNDANT_PARAGRAPH);
}
else if (newLine == null || tag.getLineNumber() - newLine.getLineNumber() != 1) {
log(tag.getLineNumber(), MSG_LINE_BEFORE);
}
if (isMisplacedParagraph(tag)) { // this line is changed.
log(tag.getLineNumber(), MSG_MISPLACED_TAG);
}
}With this there was no error of: and I also didn't needed to set |
|
this Check code is very hard to read, lets refactor it a bit before this PR to proceeed. please look at #15709 and try to finish it. |
eff31fd to
fd5db92
Compare
|
build is still failing, there are still lots of errors |
|
before we proceed on this, all other PRs and issues should be merged. |
|
@Zopsss , please resolve conflicts in this PR to let me start review. |
fd5db92 to
a358f05
Compare
reverted this as we fixed this in one of my old PR. |
|
local build was still failing, it was mostly giving errors for: It was also giving this error: for cases like: the above error is fine, it is violation of rule but other 2 errors are false-positive, they started appearing because we added support to check for open-close tag. Should we keep these errors or not? If yes, then it would require changing lots of files. |
|
checkstyle/config/checkstyle-checks.xml Line 720 in 37a777c
This means that allowNewlineParagraph= true And it means that you have defect, as this property is to allow \n. |
yes we allow it, so that check does not give violation on lines like: checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheck.java Lines 28 to 31 in 37a777c
the default property is what we need for our style. We set it to false for google_checks.xml because it does not follow such rules. |
|
Google style use false, checkstyle style is true. |
a358f05 to
643b58d
Compare
| <!-- | ||
| Until we fully support opening-closing paragraph tag | ||
| https://github.com/checkstyle/checkstyle/issues/15685 | ||
| --> | ||
| <module name="SuppressionSingleFilter"> | ||
| <property name="checks" value="JavadocParagraph"/> | ||
| <property name="message" value="tag should be preceded with an empty line."/> | ||
| </module> | ||
| <module name="SuppressionSingleFilter"> | ||
| <property name="checks" value="JavadocParagraph"/> | ||
| <property name="message" value="Redundant .* tag."/> | ||
| </module> |
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.
suppression until we fix the implementation of this check. May change the referenced issue in future if we open new issue for 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.
We need to fix almost all violations from Paragraph Check.
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java
Lines 84 to 86 in aeaf4b0
| * </pre> | |
| * <p> | |
| * See <a href="https://github.com/checkstyle/checkstyle/pull/10434">#10434</a> |
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.
If there is some strange cases, report to us and skip them for now, we will handle them at the end of as soon as you get confirmation on how to update javadoc.
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 fixes, please continue #15737 and all other fixes.
We eat food we produce before we release to it to users, we need to fix all of 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.
Put this link in comment , you will update all in separate PR
|
A PR has been sent for failing CI: https://checkstyle.semaphoreci.com/jobs/46bc3abc-9190-43d9-bb99-3a25a47a386b |
643b58d to
c80a41c
Compare
|
fixed some bug related to |
|
@Zopsss , please send PR to pgjdbc project to fix violations. |
c80a41c to
88c23c4
Compare
|
Build is flooded with errors again :( this time it is because of following type of violation: should I add suppression for this too? |
|
GitHub, generate report for configs in PR description |
|
This PR is unblocked and will be final functional update for this Check. |
88c23c4 to
1042402
Compare
|
Addressed #15732 in the latest push: https://github.com/checkstyle/checkstyle/compare/88c23c4e17b959575de5fccbe349c1e7d06b312d..1042402e60a306559e7a2f263389b8ec7d91ddaa ignore failing build, reason explained at: #15686 (comment) |
c0d510e to
cb7cac3
Compare
|
not sure why ci is failing local build was passing. |
|
Github, generate site |
|
https://ci.appveyor.com/project/Checkstyle/checkstyle/builds/50771010/job/410wglmmfwmaa7nr#L254 It prints allowed tags , see all in link |
romani
left a comment
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
cb7cac3 to
dedae08
Compare
|
Github, generate site |
|
Github, generate report for JavadocParagraph/Example2 |
|
GitHub, generate report for JavadocParagraph/all-examples-in-one |
dedae08 to
5a6b51e
Compare
|
Report for JavadocParagraph/all-examples-in-one: |
|
Report for JavadocParagraph/Example2: |
116c234 to
bc5dfcf
Compare
romani
left a comment
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.
Ok to merge
rdiachenko
left a comment
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.
Minor note, ok to merge after it is fixed.
| * @return true, if the paragraph tag is nested. | ||
| */ | ||
| private static boolean isNestedParagraph(DetailNode tag) { | ||
| boolean isNested = 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.
Please rename to nested, it's a variable name, shouldn't be a verb.
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
…g when they have their corresponding closing tag
bc5dfcf to
ca20d44
Compare
|
Check no closed issue reference failing CI is addressed at #15765 |
romani
left a comment
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 see fix for above item.
fixes #15685 #15732
tried fixing the implementation of JavadocParagraph
might have introduced new false-negatives :pI tried to make the Check work same way when the paragraph tag's corresponding closing tag is also present.
when I tried to run build command locally, I got so many errors for different files like checks, filters, etc for
<p>tag. Most of them were for:@romani need your help here
Diff Regression config: https://gist.githubusercontent.com/Zopsss/013f379d4c821f2d624be56212a64575/raw/5f17ec9186d4421396429ab38cbac3e4663bf4eb/javadocparagraph_config.xml
Diff Regression projects: https://raw.githubusercontent.com/checkstyle/contribution/master/checkstyle-tester/projects-to-test-on-for-github-action.properties