-
Notifications
You must be signed in to change notification settings - Fork 170
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
Standardize _details
#3924
Comments
Do we want to do this as part of rewriting the documentation to conform to (and be incorporated in) the other diagnostic messages documentation, or do we want to do this in place of merging the documentation together? |
The former, this doesn't need to be done separately. Effective Dart points to linter rules and vice versa. But it seems like there's no linking/connection between Effective Dart and diagnostic messages in either direction. (I could be mistaken, could you point me to the source of a diagnostic message, like the equivalent of the individual lint sources I linked to in my original description? I'm just looking at the rendered docs and don't see any links.) So, do we want linter docs to conform to diagnostics in the sense that they don't have a connection to Effective Dart at all?
|
Kind of a long winded answer, but hopefully there's some useful background info somewhere in it. There are three kinds of diagnostics produced by the analyzer:
Effective Dart is a set of primarily stylistic advice that reflects the common use of the language in the community. Some of the advice in Effective Dart can be checked statically, and for those cases we try to have a lint that can do the checking, but not all of the advice can be checked statically, so there are no lints for those pieces. Similarly, not all of the lints are related to advice in Effective Dart. So, there is an overlap between the two, but not a 1-to-1 correspondence, and neither is a subset of the other. But you're correct that there's no overlap between Effective Dart and the non-lint diagnostics, simply because of the way we group diagnostics into the kinds above. Because we started writing lint documentation before any other diagnostics had been documented, we just chose a convenient place for the docs to live. Later, when we started documenting the non-lint diagnostics (an ongoing process), that location wasn't deemed to be appropriate, so a new location was chosen. The desire is to move all of the documentation for all of the diagnostics into the same location, and part of that work would likely require that the lint documentation follow a format similar to the other diagnostic documentation. Though exactly what that means is open to discussion (a discussion I hope we can have fairly soon). I think we want to make it clear in the diagnostic documentation whether the diagnostic is an error, warning, or lint. I think the documentation for lints that correspond to advice in Effective Dart should have a link (and vice versa). I think that when we restructure the lint documentation we should consider having some sections that don't appear in non-lint docs. I think it's useful to have both a "Description" section that describes what the lint does and a "Motivation" (or some such) section that describes why this is useful to a user, which in some cases would just be a pointer back to Effective Dart. But I'd like to morph all of the "GOOD" and "BAD" examples into the "Examples" and "Common Fixes" style because I think it's more helpful to describe what the change is than to just show the changed code. There are lots of details that we need to work through. And to answer your question: the documentation for the non-lint diagnostic is kept in a YAML file (https://github.com/dart-lang/sdk/blob/main/pkg/analyzer/messages.yaml#L163), which is used to generate, among other files, a markdown file (https://github.com/dart-lang/sdk/blob/main/pkg/analyzer/tool/diagnostics/diagnostics.md) that is then uploaded to the web site. |
I noticed a few minor aspects of lints'
_details
are pretty non-standard. This seems counter-productive for users looking for a quick solution, if that information is formatted differently every time it pops up.I'd be happy to do the actual standardization across all the lints if the team wants to agree on standards.
My take:
link to dart-lang/site-www#4393
The text was updated successfully, but these errors were encountered: