-
Notifications
You must be signed in to change notification settings - Fork 1.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
unintended_html_in_doc_comment false positives? #59516
Comments
Slight correction: For the ` case the lint only triggers in one particular case: https://github.com/flutter/flutter/blob/70460854d1831990b5784c91f0982a95012f9722/packages/flutter/lib/src/animation/tween.dart#L224 Maybe because the previous ` section spans over multiple lines? All other ` instances seem to not fire the lint as expected. |
Yeah, the lint seems to have a problem with multi-line ` sections. Here is another example where it triggers incorrectly because of that: https://github.com/flutter/flutter/blob/70460854d1831990b5784c91f0982a95012f9722/packages/flutter/lib/src/painting/shader_warm_up.dart#L75 Rendering is fine: https://github.com/flutter/flutter/blob/70460854d1831990b5784c91f0982a95012f9722/packages/flutter/lib/src/painting/shader_warm_up.dart#L75 |
So the two issues are:
|
I wish we supported I haven't gotten it in because it's actually a fairly complex parsing feature, like we'd want to support |
Correct me if I'm wrong, but I think it's more than a parsing feature. We have a parser that knows how to parse type annotations, so if that's all this required it seems like that wouldn't be too hard. But the feature also requires resolution, which might be the harder part. |
I used the `unintended_html_in_doc_comment` to find these, but sadly the lint is not ready to be enabled yet due to https://github.com/dart-lang/linter/issues/5065.
See #56465 for the same issue, and https://dart-review.googlesource.com/c/sdk/+/379519 for fixing the It still lists To repeat #56465, the issue here is that the lint uses a RegExp to match a language that probably isn't entirely regular (even if its tokens might be). When doing that, it's necessary to correctly match all tokens that can contain something that looks like what you're looking for, but where it means something else. Here That means that just ignoring the content of One option is to ignore the content of a Also tricky because (The HTML-tag detection would now probably not trigger on |
It does, since the RegExp is applied to each line independently. Yaml parsing is per-block, so the RegExp has no chance of knowing how something should be tokenized. An unmatched To give more correct results, the lines should probably be concatenated, at least per paragraph. |
I used the `unintended_html_in_doc_comment` to find these, but sadly the lint is not ready to be enabled yet due to https://github.com/dart-lang/linter/issues/5065.
I'm facing a similar bug with: /// `<`, `>`
/// `<>`
/// `<`
/// `>`
final String name; The first line fires the lint while all other lines do not. |
Sorry @Leptopoda I cannot reproduce. That issue should have been fixed with df283fd. If you still face a problem, please open a new issue. |
In the following doc comment the
unintended_html_in_doc_comment
lint fires on[Tween<Offset>]
andTween<T>
even though the docs render correctly.(For the correct rendering of these references search for them on https://main-api.flutter.dev/flutter/animation/Tween-class.html).
At least the reference in ` should not trigger the lint (which would be in line with what is documented: https://dart.dev/tools/linter-rules/unintended_html_in_doc_comment).
I was a little surprised that the reference in [] triggers the lint (as documented) since it seems to render totally fine.
The text was updated successfully, but these errors were encountered: