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 how we reference formatters, linters, and checkers in goal summary #14355
Conversation
…l summary # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
I see three obvious options here (somewhat in my order of preference): a) Explicitly name each use of a tool, i.e. have separate fields for presentation and api. class MyTool (Subsystem):
api_name = "my-tool"
display_name = "My Tool" b) Derive the display name from the api name. class MyTool (Subsystem):
api_name = "my-tool"
# Infer display_name i.e. replace `-` => ` ` and then capitalize each word. c) Derive the api name from the display name. class MyTool (Subsystem):
display_name = "My Tool"
# Infer api_name i.e. replace ` ` => `-` and then lowercase the whole thing. I would prefer |
@@ -24,7 +24,7 @@ class GoCheckFieldSet(FieldSet): | |||
|
|||
class GoCheckRequest(CheckRequest): | |||
field_set_type = GoCheckFieldSet | |||
name = "go compile" | |||
name = "go-compile" |
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.
(Non-blocking, this PR is an improvement so it belongs in)
This is the odd duckling, which got me wondering what these are used for.
AFAICT (and mypy
backs me up) they are only used on the superclass for debug_hint
. That could probably get away with using cls.__name__
🤷♂️ . Then the only remaining usages are in each tool's @rule
s as a DRY way of using the name (E.g. formatter_name=request.name
). In that case, we could reference the subsystem.options_scope
in all cases except this one, where we could hardcode it.
Of course, instead of an implicit convention (which this now has), in the future #14238 could implement a helper method which then allows for a codified convention 😉
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.
See #14356, which this is all prework for.
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 see. It'd be nice if these things were more automagical if the client followed a convention (much like how Django operates for a lot of things).
But I'm just soapboxing now 😄
I'm not following why we would differentiate between display name vs API name? The help message for
That's tricky because we don't want to capitalize each word.
That could work, although I don't think we need to differentiate display vs API. |
Yeah, in that case I don't see any issues. Guess I went down the wrong hole by misinterpreting the meaning of "Generally, we're inconsistent with how we capitalize." ;) |
Oh yeah, I should have clarified "intentionally inconsistent" :) |
I love consistency, but one other option that wasn't mentioned in @kaos's list:
We could also make the match fuzzy/partial/case-insensitive, similar to That doesn't mean that the names aren't a public API... just that it might not matter how long/short/stylized they are. |
Agreed. At a minimum, don't care about capitalization. Maybe allow spaces to be substituted with So I went for the simpler approach of consistency. Which has the added benefit of the final summary being sorted better. (Although I guess we could sort by |
What do folks think? Am I okay to merge this PR as is? Fwit, if we in the future decide we do care about the display name going back to some capitalization, we could change them back and add the fuzzing/insensitivity? (I personally don't find the capitalization valuable enough to do that though, yay consistency) |
I'm actually finding we're kind of duplicating these strings in several places. I have some thoughts on reducing duplication.
So I think @kaos 's option C would likely reduce this list down to 1 declaration in most cases. |
We shouldn't be anymore? We now only define the string once:
I don't think the propagation is a big deal? What I didn't like was setting up the string as a new value multiple times, which we used to do. |
Problem
Soon we're adding
lint --only=<tool>
, so the name of these tools will become part of our API. Some of the tools currently have spaces, which means you need quotes withcheck --only='go compile'
. Generally, we're (intentionally!) inconsistent with how we capitalize.Because of inconsistent capitalization, our final summaries also don't sort how users might expect.
Before
Note that autoflake shows up as the 4th entry, not the 1st.
After
[ci skip-rust]