-
Notifications
You must be signed in to change notification settings - Fork 58
YETUS-1099. shelldocs --lint option fails #212
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
| "audience": ("Public", "Private"), | ||
| "stability": ("Stable", "Evolving"), | ||
| "replaceable": ("yes", "no"), | ||
| "replaceable": ("Yes", "No"), |
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.
'Yes' and 'No' are not documented as being valid.
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.
yetus/shelldocs/src/main/python/shelldocs.py
Lines 174 to 178 in 227c762
| def getreplace(self): | |
| '''get the replacement state''' | |
| if self.replaceb: | |
| return "Yes" | |
| return "No" |
Here
self.getreplace returns "Yes" or "No", therefore I changed the valid values correspondingly to pass the elif statement below:yetus/shelldocs/src/main/python/shelldocs.py
Lines 278 to 283 in 227c762
| elif value not in validvalues[attr]: | |
| validvalue = "|".join(v.lower() for v in validvalues[attr]) | |
| messages.append( | |
| "%s:%u: ERROR: function %s has invalid value (%s) for @%s (%s)" | |
| % (self.getfilename(), self.getlinenum(), self.getname(), | |
| value.lower(), attr.lower(), validvalue)) |
Should I update self.getreplace to return "yes/no" instead of "Yes/No"?
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.
Rethinking this, just adding a function to get the raw replaceable text is fine.
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 point of YETUS-1089 was to better enforce the ruleset and provide valid output. 'yes' or 'no' are the values that are considered valid. A value of 'Yes' or 'No' would be considered invalid and they should throw an error. Checking the validity of the rendered output rather than the parsed value doesn't do that.
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.
Thank you @aw-was-here for the detail. I've updated the patch to check the parsed value. 0e3b97a
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.
yetus/shelldocs/src/main/python/shelldocs.py
Line 283 in 227c762
| value.lower(), attr.lower(), validvalue)) |
You said the validity check should be case-sensitive, so I thought
value.lower() should be value in the error message. What do you think?
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 thought value.lower() should be value in the error message.
Umm. It is not good for other attrs because the validity check of the attrs looks case-insensitive.
|
@aw-was-here Would you check the latest commit? I think now it validates the parsed value. |
|
I'll merge tomorrow if there are no objections. |
|
Yeah, this might work. Might as well commit it and we'll deal with it later if it doesn't. (There are a ton of other bugs in 0.13 that are probably more visible soooo) |
|
Thank you @aw-was-here and @busbey |
JIRA: https://issues.apache.org/jira/browse/YETUS-1099