-
Notifications
You must be signed in to change notification settings - Fork 5
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
Simplify Warnings #526
Simplify Warnings #526
Conversation
I think this is still too complex. There's no need to have all these doc comment sub categories. I think we should do the following.
Maybe we need one or so more doc comments, but not nearly as many as we have now. For |
What do you mean by subcategories? We only have 3 categories and there are no subcategories.
Why? What's wrong with providing fine grained warning suppression? I'd be fine using human-readable names instead of warning codes, if that's what you're talking about though.
These are the 3 categories that we have currently, albeit it with different names. |
It's too fine grained. We just don't need to support all the ways you can miss parts of doc comments.
I was staring at Rust when I wrote my comment. They should indeed always be pascal case. We need to decide on which warnings have. The name should also be something that makes sense when you used in context with For instance, We currently have:
I propose the following restructuring and renaming.
To add in
Ones I would like to merge.
Into two:
|
What does this mean? Will we still provide warning codes with the diagnostic? MSBuild logger expects these warning codes. Do we really need this feature? it doesn't seem that useful to suppress categories of warnings. |
We just won't have a code like |
You should open an issue. It's hard to keep track of proposals hidden in PR review comments! |
It's a comment directly related to the content of the PR. I can comment on the original issue. We can open an issue for future improvements after this PR. |
Fine with me, but will this work with the builder @pepone? Can it take any string as a code, or does it require a specific format?
I'm guessing this is another terminological difference here, but then what do you propose calling them?
Do you think that specifying
What do you mean by merge? Do you mean like, actually merge the
Okay, but why? It's trivial to implement, and seems useful to me. I'm fine with the proposed categories, but I think it's still worth having an
Also, while I don't find this compelling, I'd note that supporting this is pretty standard for every major compiler. |
Yes, any string will do. |
Short & clear is ok, short & confusing is not. What is a "malformed comment"? A comment with a non-ASCII character? I find this term very confusing. |
I agree, "malformed" is a slightly odd choice. Maybe we should use "invalid" instead? |
Just to show that fine-grained has some precedence, |
I think @bernardnormier was referring to "malformed doc comment" vs "malformed comment". The later doesn't make sense. You can't have malformed comment, but you can have a malformed doc comment. |
EVERYTHING ABOVE THIS COMMENT IS OUTDATED NOW! |
I reworked the PR from the ground up, so I marked all the old review comments as "Resolved" since they're inapplicable now. This PR does the following:
|
Now,
This is how the old warnings were mapped to the new ones:
|
I opened an issue for adding warnings for missing doc comment things in |
I assume BrokenLink is purely about doc-comments? We don't care about links in regular comments. And for actual Slice definitions, a broken reference (like |
Yes. Non-doc-comments are completely ignored, so even if you type the syntax of a link, it has no semantic meaning.
I think "link" is clear enough, and that most of our users wouldn't consider "referencing a type" to be a "link". |
I think we should rename it |
Or maybe |
Link is the keyword used in the doc comments themselves so I'd be inclined to use it in the warning name. |
.set_scope(operation.parser_scoped_identifier()) | ||
.report(diagnostic_reporter); | ||
Diagnostic::new(Warning::IncorrectDocComment { | ||
message: "void operation must not contain doc comment return tag".to_owned(), |
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 don't think would use the phrase "void operation". What about something like:
doc comment contains a return tag but the operation does not have a return value
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 know that I changed 2 messages in this PR, but I think I'm just going to open an issue to check the others.
This PR was originally supposed to be about adding warning categories, and it's already come pretty far from those tracks.
#[test_case("Deprecated", [1, 2]; "deprecated")] | ||
#[test_case("BrokenLink", [0, 2]; "broken_link")] | ||
#[test_case("IncorrectDocComment", [0, 1]; "incorrect_doc_comment")] | ||
fn allow_only_specified_warnings<const L: usize>(arguments: &str, expected_indexes: [usize; L]) { |
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 find this test confusing. What is it testing?
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.
It's testing that only the correct warnings are emitted.
So for instance allow
ing Deprecated
shouldn't have an effect on warnings unrelated to it.
It does this by having an array of 3 warnings, and each test case says what warnings should be emitted (by index).
I can split this into 3 tests, write a doc comment, or something else. Let me know what you think is best.
Co-authored-by: Joe George <joe@externl.com>
Co-authored-by: Joe George <joe@externl.com>
I renamed |
@InsertCreativityHere the actions are failing still! |
This PR implements #463 by adding the ability to suppress warnings by category, instead of requiring a warning code.
There are 3 categories:
All
,Deprecated
, andComments
. These arguments are case sensative and required.Previously, writing the attribute with no arguments:
[allow]
said to allow all warnings. With these changes, it is an error to not supply an argument. If a user wants to suppress all warnings, they need to explicitly say so with:[allow(All)]
It also:
-w
command line argument to-W
, as pointed out in Improve slice compiler help #517 (comment)-A
as a short option for--allow-warnings
(currently we only allow the fully-written-out option)InvalidWarningCode
error. Now we emit anArgumentNotSupported
error like we do for every other place a bad attribute argument is supplied. There's nothing special about theallow
attribute that deserves its own error.DocComment
vsComment
for the category nameTechnically, since normal comments are completely ignored, only doc comments can cause warnings to be raised.
But saying
Comments
is still completely correct and easier to type, so I chose that as the category name.