-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New lint proposal: end_doc_comments_with_punctuation #58188
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
Comments
Thanks for opening an issue to discuss this rule. I'm concerned about the number of false positives from such a lint. While we do allow a small number of false positives from a lint rule (when they are unavoidable and rare and the value of the rule is sufficient to justify the cost of dealing with those false positives), we strive to have as few false positives as possible. My guess is that this rule would have too many false positives and not enough value to enough users. In his comment on the PR, Sam gave several good cases where this lint (as written) could validly be violated and I suspect that there are plenty of others. In general, natural language processing is beyond the scope of what the linter is currently able to support (which is part of why #57202 hasn't been addressed), and I think it's better to not introduce lints that require natural language support.
There are additional punctuation marks used by languages other than English that would probably need to be supported. |
I admit I hadn't thought about some of the concerns Sam raised when I encouraged @nscobie to open this. For context, this is a rule that is motivated by an internal request. @nscobie: I'm curious, have you run this across your team's code corpus? |
@bwilkerson: You and Sam both raise very valid points about how this could go wrong, and after thinking about your examples I totally understand the desire to not open up this can of worms. However, I am quite curious now about our discussion on PR dart-archive/linter#2148 regarding parsing Markdown, and would like to briefly investigate your suggestions about measuring false positives and performance before giving up. Also, regarding additional punctuation marks used by languages other than English: perhaps we could reduce our scope by clearly marking this lint as only supporting natural languages X, Y, and Z? I'm unsure if that would be too exclusionary. @pq: Unfortunately I cannot test this rule against my team's code corpus, I'll message you with more details. I will look into running it against the Flutter framework and popular packages on pub.dev soon. And while it was motivated by an internal request, my understanding is that it's not high priority. |
I fully support you investigating further. My intuition isn't perfect. :-) |
Uh oh!
There was an error while loading. Please reload this page.
Related PR: dart-archive/linter#2148
Describe the rule you'd like to see implemented
A simple style rule to help enforce proper grammar in documentation comment blocks by ensuring they end with proper sentence terminating punctuation.
Terminating punctuation would be defined as one of the following: period (
.
), question mark (?
), or exclamation point (!
). The rule would effectively only check the very last character of the entire comment block (with the exception of Java-style doc comments), and would not attempt to enforce any punctuation rules for sentences "higher up" in the comment.The lint would only apply to documentation comments (
/// Blah.
or/** Blah. */
), and would not apply to normal comments (// Blah.
or/* Blah. */
).This rule is not specific to any particular framework, and could help anyone utilizing
dartdoc
.Examples (test cases from PR)
Additional context
Open questions
end_doc_comments_with_punctuation
okay, or would something else be preferred?:
)?The text was updated successfully, but these errors were encountered: