-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add a command-line flag to override the major/minor/patch release detection logic #359
Comments
Would probably take the form of an option, like Let's bikeshed some names for
Any others? Any strong feelings toward or away any of these? @tonowak @epage would love your thoughts in particular. This addition would make |
Although my opinion probably doesn't count much :) I like That's my 2 cents :D feel free to ignore |
This gets a bit into #58 territory. There are two angles to lint levels, compatibility level and reporting level. This is about the compatibility level. I lean towards something like do An interesting angle to this is "major", "minor", and "patch" will likely be relative (0.x.y has "x" as major in relative terms and minor in absolute terms). |
Correction, there are three angles to all of this
We need to be able to change the compat level of a lint (#58) and declare the compat level of the project (this project). We should decide on names in tandem between this and #58 to make sure they are aligned. |
We appreciate your opinion! I had the same thought process with
Would an example of reporting level be "for our crate, MSRV changes are patch, regardless of what cargo-semver-checks thinks"? What's an example of the compat level of the project? |
rustc has the concept of "cap lints", meaning you can limit what lint levels get reported. This is currently used when building dependencies to prevent their warnings from being shown. Using similar terminology might help? So |
I do like |
In #58 I talked about compat level (major, minor, patch) in the same breath as reporting level (forbid, deny, warn, allow) but they are separate concepts in discussion, regardless of how we present them in UI |
Re:
Would you be opposed to
Yes, I think the semver levels have to be relative here, but I agree that it makes sense for |
@obi1kenobi Here a first draft. Review appreciated. Didn't add a test yet; I was a little confused by how you guys lay out your tests or whether you do unit tests at all. |
For CLI features so far we've been using CI jobs over real-world crates. I can add that in a separate PR if you'd prefer, it's not hard for me to do. |
There is something about That spelled out idea is making me think this is a jumbled ball as it ties into #86
|
Alternatively, an integration test in the |
I think it's much harder to understand the meaning of a flag checking
If I was a first-time user of the tool, I would try to first run the tool and then limit the output to only those lints I care about -- I would prefer to specify what needs to be checked and experiment with it, and not specifying what the state of the project is (especially that "state of the project" is clear in the sense of PRs, but not necessarily for people experimenting with the CLI in their project). Also, The meaning of the |
Reading those comments I think it's important to highlight it again: You are talking about two different mechanisms here.
Which one do we want to implement now? Or both, one being Just so I can still follow. |
Here's my mental model. There are two level of lints:
And then, depending on the kind of release you're making, you either get both lint types, or only the minor lints. Both I don't really understand the idea behind the |
@Darksonn So the question is, if the new version number in
|
FWIW, to me it seems like it would be the latter: |
@obi1kenobi, @Darksonn, @tonowak, @epage: Next review request, now with Is that what you had in mind? |
@obi1kenobi I now implemented it so that two things have to be given for a lint to run:
|
I think a lot of confusion in this entire discussion comes from the fact that there is a brainf*ck mismatch between version increments and filter levels. A |
For me, the problem is there are two different kinds of lint levels, the semver level and the reporting level. Granted, rustc's version of "lint level" for reporting has a different name (cap lint) so we would unlikely use I will say, runtime experience is one way to learn so we can go forward with a name but we should call out re-evaluating it in the stablization / cargo merge Issue. |
(also I disagree with the "override" framing as instead the flag is saying what is happening but the tool is inferring a default, same effect different mental model). |
@epage No override is happening. It's an additional filtering. There is no As there still seems to be a lot of confusion, let me propose a new solution: ReasoningThere are only two lint levels:
So having a
ProposalAs this is quite unintuitive, why not introduce a flag Without the flag, it simply runs all lints, and with the flag, it skips Skipping Skipping So from a filter point of view, enabling or disabling Thoughts, @obi1kenobi? |
@Finomnis regardless of the name, I've always seen this as |
@epage I think different people are talking about different things here. I'm pretty sure @Darksonn is talking about filtering/separate check:
Apart of the fact that she's calling it Also, @tonowak said:
And "limit the output to only those lints I care about" to me sounded a lot like filtering, after which you replied that he convinced you. He didn't write "overwrite lints to the ones I care about". I assumed you were talking about the same thing, I think I also misread this message of yours:
I think I read that as "you don't want an override". It might make sense to have an actual override, but after talking about it, I think what we really need in |
New attempt to implement what we need in @Darksonn From the perspective of Once we do want to publish a new major version, we can simply increment it in But as long as we don't, the linter would always assume that the next version we publish is at least a |
@epage I just read through #58 and your point of view makes a little more sense to me now. With that, let me talk about this post of yours again, because I think it's very relevant to which direction to go into:
I'm not 100% sure what you mean with that. The "compat level of a lint" makes sense to me, this is what type of version increment is required if the lint fails. The "compat level of the project" kind of confuses me, why would a project be of a specific compat level? Shouldn't it depend on the specific PR, and which version the project wants to publish next? I don't completely understand the "reporting level of a lint". Is this at what level to report, but without making the check fail? The level that I'm interested in is the "filter level of the project", meaning, downgrade lints that are less than a specific lint level to "informal", meaning they don't break the CI check. Although I agree that this might be a very specific usecase and might not be generic enough to fit into your model. I understand that you have more complex plans with lint levels, so I am open to what you suggest. I'm confused, to be honest, about all the different types of levels we are talking about now. |
I apologize if I am too opinionated here. I'll take a step back and let you guys talk it out. Make of my pull requests what you want :) |
I'm meaning "the current state of the project" or "what compat level someone is interested in"
rustc lints can be |
Also, I thought had said this but can't find it: I'm talking there are these different levels in principle but that doesn't dictate how we expose them or that we might comingle them. For example, maybe there are auto-lint groups based on the semver level of the lint so you can do |
Maybe the discussion shouldn't be about the lints in the first place? You have a feature that detects what kind of release we're going to make next (patch, minor, major) by looking at the toml, and the flag overrides what release type that logic detects. The release type affects which lints trigger and which don't, but fundamentally what I wanted to override is the release type detection. |
OK by now I think I completely misunderstood what the goals were :D so my first PR was what we needed, except that the name confused everyone? |
This is a tricky issue. Thank you @Finomnis and @Darksonn for thinking through it with @epage and me — I think our solution will be that much better for it. I want to summarize my understanding so far, make a concrete proposal to move us forward, and offer justification for it with my opinions. SummaryI believe there are three separate-but-interconnected things in play:
There's overlap between 1. and 2., in that setting a check to a hypothetical "patch" compat level (if one existed) would be equivalent to setting it to "allow" reporting level. This is why there's no "patch" compat level — it's redundant. It's in principle possible to express 3. as just a more concise way to set a group of 1. and/or 2. settings. For example: (Aside: here's a plausible example of a compat-always, reporting-warn lint, which is not something we have today: "added a new exhaustive pub enum, are you sure you don't want to make it Opinion / JustificationI think we want all three of these. It's reasonable for a project to change the compat level: "for us, MSRV bumps are minor-deny", if the default had for example been set to "major-allow". (Setting completely aside whether this is a good default or not.) It's also reasonable for a project to change the reporting level: "API additions are minor-deny" changing from a presumed default of "minor-allow". It's also reasonable for either a project or for a human using the CLI to want to set a group of settings more quickly than typing in a bunch of individual overrides, even if there are lint groups that allow setting compat/reporting across a group like Proposal
In terms of merging into cargo:
Thoughts? |
@obi1kenobi one nit pick on my side:
For me, I feel like the "version detection" framing focuses on the wrong part, on the mechanism for how we get the default value (that we are now wanting to explicitly set) rather than how its used. With that said, my earlier comment stands that I am mostly fine with us merging whatever to collect real-world feedback and marking this as an open question for the cargo merge. I appreciate that we've talked this through and I think its productive all around for understanding use cases, designs, etc but as we still have the power to change things, we should time-box the conversation and move on. |
I understand. Perhaps we can find a better name for it. In my head it continues to be just a shorthand for setting a bunch of compat and reporting levels at once, with explicit overrides of either of those dominating. The underlying implementation isn't that important to me. Let's move forward! I'll merge the |
I like |
The name |
Re-opened and updated #361. Review required :) |
Awesome, merging! Thanks again for both the patience and the contributions! Tentatively planning to release on Monday morning US/Eastern time, so afternoon in Europe. |
Thanks everyone for the heated but fruitful discussion :) |
Passionate collaborative problem-solving! |
Originally posted by @Darksonn in tokio-rs/tokio#5437 (comment)
Possible workaround for users until we can come up with a more full-fledged solution for #58
The text was updated successfully, but these errors were encountered: