-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Limit cargo add feature print #12662
Limit cargo add feature print #12662
Conversation
r? @ehuss (rustbot has picked a reviewer for you, use r? to override) |
Let's skip this for the MVP because that gets messy and I want to wait until we switch to anstream which will make it less bad |
Could you update this so the first commit adds a test showing the original behavior and then the commit with the condensed view will be the following commit and will then show how the view changes? Test cases I expect
|
☔ The latest upstream changes (presumably #12655) made this pull request unmergeable. Please resolve the merge conflicts. |
I've added the tests as required and rebased with the changes from #12655. Would you believe my blind self actually missed the entire tests folder at first? I was actually grepping for As a side note, the test code for both tests is almost identical, but I noticed that that's also the case for the rest of the cargo_add tests. Would you prefer I try to do some de-duplication or are we good to go? |
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.
Would you prefer I try to do some de-duplication or are we good to go?
The two newly added test cases look good to me :)
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.
Thanks for the update. I believe this meets what epage expects pretty much. I am going to merge it :)
@bors r+ |
Thank you @weihanglo and @epage . I feel like these things are not said enough, but so far these little pull requests have been the simplest, fastest, most straight forward and nice open source contributions I've ever been able to do. My applause to the maintainers, you're doing a great job! |
☀️ Test successful - checks-actions |
@Angelin01 I think there was a miscommunication that led to this being merged. This started as a draft, so I was unsure where it was at compared to #12617, so I didn't say anything about it yet but this does not match the last UX proposed in the issue and I would have expected it to match or for more discussion to have happened before moving onto the PR if there was a disagreement about it (which is fully valid to do). |
@epage I simply went with @weihanglo review, I assumed things were ok! At least, I thought the format was settled, as I had provided sample outputs in the PR description and tests, but we obviously jumped the gun! |
As I said, this should have been brought up in the Issue before creating the PR. In some cases, the PR process discovers new information then it can be brought up then and that should be explicitly called out rather than hoping that the reviewer notices the discrepancy.
Open to just doing a follow up PR to go with the original design or do you consider this unresolved enough that we should undo it? |
@epage I can certainly do a follow up, most of the work here can be used. Feel free to open a new issue or reopen the issue and @ me, but I think I need clarifying on what the original design is, I'm still unsure what does not match what was expected in the issue (aside from the link, which we discarded because of the library migration). |
@Angelin01 that was my fault. Sorry. I saw this comment and though you've agreed on something 😅. |
Update cargo 11 commits in 2fc85d15a542bfb610aff7682073412cf635352f..d5336f813df39d476e61fc46daabb1446350660a 2023-09-09 01:49:46 +0000 to 2023-09-14 19:55:49 +0000 - fix: emit a warning for `credential-alias` shadowing (rust-lang/cargo#12671) - refactor: fix lint errors in preparation of `[lints]` table integration (rust-lang/cargo#12669) - Limit cargo add feature print (rust-lang/cargo#12662) - Clippy (rust-lang/cargo#12667) - Prerelease candidates error message (rust-lang/cargo#12659) - Fix typos: `informations` -> `information` (rust-lang/cargo#12666) - chore: update globset to 0.4.13 (rust-lang/cargo#12665) - refactor: Consolidate clap/shell styles (rust-lang/cargo#12655) - libgit2 fixed upstream (rust-lang/cargo#12657) - Index summary enum (rust-lang/cargo#12643) - feat(help): Add styling to help output (rust-lang/cargo#12578) r? ghost
Readyness checklist
[ ] The "X more features" messages should be hyperlinksWhat does this PR try to resolve?
Fixes #12617
Limits the amount of printed features to 49. After that, it simply prints "... X more activated features" and "... Y more deactivated features".
How should we test and review this PR?
Two new tests were added to validate the functionality, see
tests/testsuite/cargo_add/features_too_many_activated
and tests/testsuite/cargo_add/features_too_many_few_activated.
The first commit shows the output before this PR, the second with the modifications.
To test it live, run cargo add with a crate with a ton of features, such as web-sys
A few commands and sample outputs:
Adding web-sys with no features activated
Command:
Output:
Adding web-sys with only some features activated
Command: ```shell cargo add --dry-run web-sys -F AbortController -F AbortSignal -F AudioEncoder ```Output:
Adding web-sys with only more than 50 features activated
Command: ```shell cargo add --dry-run web-sys -F AbortController -F AbortSignal -F AddEventListenerOptions -F AesCbcParams -F AesCtrParams -F AesDerivedKeyParams -F AesGcmParams -F AesKeyAlgorithm -F AesKeyGenParams -F Algorithm -F AlignSetting -F AllowedBluetoothDevice -F AllowedUsbDevice -F AlphaOption -F AnalyserNode -F AnalyserOptions -F AngleInstancedArrays -F Animation -F AnimationEffect -F AnimationEvent -F AnimationEventInit -F AnimationPlayState -F AnimationPlaybackEvent -F AnimationPlaybackEventInit -F AnimationPropertyDetails -F AnimationPropertyValueDetails -F AnimationTimeline -F AssignedNodesOptions -F AttestationConveyancePreference -F Attr -F AttributeNameValue -F AudioBuffer -F AudioBufferOptions -F AudioBufferSourceNode -F AudioBufferSourceOptions -F AudioConfiguration -F AudioContext -F AudioContextOptions -F AudioContextState -F AudioData -F AudioDataCopyToOptions -F AudioDataInit -F AudioDecoder -F AudioDecoderConfig -F AudioDecoderInit -F AudioDecoderSupport -F AudioDestinationNode -F AudioEncoder -F AudioEncoderConfig -F AudioEncoderInit ```Output:
Additional information
I'd appreciate code style suggestions, if anything pops out. Even though I used to work with C/C++ a lot in older times, these days I spent way too much time with Bash, Python, Java and Jenkins' Groovy and I fear I let my mannerisms leak into my Rust code sometimes.