-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 #2427: added customizable javadoc tokens #3512
Conversation
Current coverage is 100% (diff: 100%)@@ master #3512 diff @@
=====================================
Files 273 273
Lines 13074 13170 +96
Methods 0 0
Messages 0 0
Branches 2978 3004 +26
=====================================
+ Hits 13074 13170 +96
Misses 0 0
Partials 0 0
|
I doubt it was valid. It was imaginary config.
We do not have. We have only 6 Checks that extends AbstractJavadocCheck: All of them were created to cover Google style, right after ANTLR grammar was introduced. Almost all of them are simple Checks. Only NonEmptyAtclauseDescriptionCheck could have some reasons to be customized. But it was missed from our attention during implementation as no customization was required for Google style. |
we should not pollute method signatures with checked exceptions internally.
Such unclear fixes should beeasily caught by cobertura. If you do not have problem, that is strange.
hmmm, it is always a decision point to make Check stateless or stateful (you added a field - it become stateful). I always guided other to make Check stateless is there is no performace hit by it in comparison to statefull implementation. |
Then I will leave validating javadoc tokens till later, as any code I write for it now will remain untested until that time. I reverted changes to AtClauseOrderCheck.
I will start an email chain discussing this with you. :)
Cobertura just checks for dead code. It doesn't check for logic errors, which this is. Just because a method runs and returns a result, doesn't mean it returns the correct result.
you will get more calls to |
085c31b
to
c5ade4d
Compare
yes, but unpleasant code is more often read by engineers. Code looks good. please update http://checkstyle.sourceforge.net/writingjavadocchecks.html#Customize_token_types_in_Javadoc_Checks and we good to merge. |
@romani Done. |
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 address few code review points
@@ -54,6 +54,11 @@ | |||
} | |||
|
|||
@Override | |||
public int[] getRequiredJavadocTokens() { | |||
return getDefaultJavadocTokens(); | |||
} |
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.
hmm, the whole reason of the issue was to customize NonEmptyAtclauseDescription , but with such method we do not allow customization.
required should be empty array.
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.
the whole reason of the issue was to customize NonEmptyAtclauseDescription
I took your reply here to mean there were no optional tokens for any checks.
Was that documentation valid where the 2 tokens are optional?
I doubt it was valid. It was imaginary config.
Are there any other optional tokens for the javadoc checks?
We do not have.
Done in next update.
@@ -73,6 +73,11 @@ public void setOffset(int offset) { | |||
} | |||
|
|||
@Override | |||
public int[] getRequiredJavadocTokens() { | |||
return getDefaultJavadocTokens(); |
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 should be getAcceptableJavadocTokens usage. We require all.
Please fix in all other cases.
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.
Is there a reason for this? getAcceptable
's default implementation copies getDefault
, so in the end it is the same.
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.
@romani Changes were addressed. |
Issue #2427.
Added acceptable and required javadoc tokens. Code was mostly copied from
TreeWalker
which this class is mimicking.All javadoc checks required
getRequiredJavadocTokens
to be added.Questions:
1)
The issue made note of an area that had documentation on this already but was removed.
Was that documentation valid that the 2 tokens are optional?
Are there any other optional tokens for the javadoc checks? I didn't see anything jump out when glancing over.
Some things to note:
1)
We needed some place to validate that the javadoc tokens set for the check are correct and require us to be able to throw a
CheckstyleException
. I did this ininit
and so had to add the exception to the throws clause, and this is why there is an update inFallThroughCheck
. I don't see any other place we can do this.I brought this up before where none of the
AbstractCheck
methods allow throwing an exception, evenCheckstyleException
and I don't think we should use runtime exceptions.If your ok with it, I think we should change all the methods to be able to throw
CheckstyleException
s.Javadoc's
walk
method changed slightly because I think there is a bug withwaitsForProcessing
and when we loopwhile (curNode != null && toVisit == null) {
more than once since the value isn't updated.I will try to find a test to show this and add it.
AtClauseOrderCheck
changed slightly to not loop through the children, but to use the visit token's power. This would be helpful if the token appears in other places than a child of the root.