Repository navigation
[java] CommentRequired: make property names consistent - #2069
Merged
Merged
Conversation
Generated by 🚫 Danger |
Contributor
Author
|
I changed default value for headerCommentRequirement to reduce the number of violations in the report |
adangel
requested changes
Oct 19, 2019
adangel
left a comment
Member
There was a problem hiding this comment.
Thanks for your PR!
Unfortunately, I don't think we can merge it as is: We should try to keep the change as backwards compatible as possible. This means:
- Introducing a new property for class comments ✅ - already done: "classCommentRequirement"
- Deprecate the property "headerCommentRequirement" - since this will be replaced by the correctly named "classCommentRequirement".
- You can achieve this by starting the property description with the string "Deprecated! ". Then it will be rendered in the documentation as deprecated.
- To make the change for the users easier, we should then
- log a deprecation warning, if this property is not the default (the default is, as before Required).
- If the new property is the default value but the old, deprecated property is not, then use the value of the old deprecated property. This is the case, if some user configured the rule using the deprecated property
- If the new property is not the default value, then we ignore the deprecated property value. The new property will be used. We would still log a warning, if the old deprecated property has a non-default value - because then the user configured both properties, which is wrong.
- We might introduce a new property "packageCommentRequired" in order to check for formal comments for packages. However, this is completely different:
- package javadoc comments are not in every file, but only in the file package-info.java
- if the file package-info.java doesn't exist, we won't analyze it, so we can't require this comment
- the only check we could do here is "Unwanted"
- So, I'm not sure, whether checking for package comments makes sense at all?
- IMHO header comments (such as license headers, ...) are not javadoc (
/** ... */) comments, but normal (/* ... */) comments. The rule however only checks for javadoc/formal comments. So, header comments are irrelevant for this rule. - We should also improve the rule description: It currently talks about comments, which is not precise. We should clarify, that this rule only checks javadoc (formal) comments.
- Change the rule description in this file:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR fixes #1683 by introducing a separate property for class comment and making header property checking only header top-level comments