Linter: comment_references: Analyzer does not always detect member references in documentation

Created on 8 Oct 2019  路  2Comments  路  Source: dart-lang/linter

It appears the regex for matching the variable in /// This function uses [variable]. is a bit too restrictive. If I add a character like , or : directly after the ] (for example /// + [arg1]: Use to do ...), then it is no longer recognized (I rely on the analyzer to tell me if I reference out of scope things in my comments).

bug false negative

Most helpful comment

I suspect that this is because of an attempt to support [id]: http://example.com/ style link labels.

The underlying difficulty is that doc comments are an extended form of markdown in which square brackets are used both for standard markdown links and for scope-based links.

All 2 comments

I can reproduce this. Modify line 13 from test/rules/comment_references.dart:

/// Writes [y]: yay. #LINT                                                                                                                             
void write(int x) {}

and no lint is raised :(

I suspect that this is because of an attempt to support [id]: http://example.com/ style link labels.

The underlying difficulty is that doc comments are an extended form of markdown in which square brackets are used both for standard markdown links and for scope-based links.

Was this page helpful?
0 / 5 - 0 ratings