-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add various grammar changes to conflict error messages #9369
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -257,3 +257,39 @@ impl<'a> OutputWriter<'a> { | |
| Ok(()) | ||
| } | ||
| } | ||
|
|
||
| /// Given a list of names, return a conjunction of the names (e.g., "Alice, Bob, and Charlie"). | ||
| pub(super) fn conjunction(names: Vec<String>) -> String { | ||
| let mut names = names.into_iter(); | ||
| let first = names.next(); | ||
| let last = names.next_back(); | ||
| match (first, last) { | ||
| (Some(first), Some(last)) => { | ||
| let mut result = first; | ||
| let mut comma = false; | ||
| for name in names { | ||
| result.push_str(", "); | ||
| result.push_str(&name); | ||
| comma = true; | ||
| } | ||
| if comma { | ||
| result.push_str(", and "); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Boooo Oxford comma! |
||
| } else { | ||
| result.push_str(" and "); | ||
| } | ||
| result.push_str(&last); | ||
| result | ||
| } | ||
| (Some(first), None) => first, | ||
| _ => String::new(), | ||
| } | ||
| } | ||
|
|
||
| /// Capitalize the first letter of a string. | ||
| pub(super) fn capitalize(s: &str) -> String { | ||
| let mut chars = s.chars(); | ||
| match chars.next() { | ||
| None => String::new(), | ||
| Some(c) => c.to_uppercase().collect::<String>() + chars.as_str(), | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2361,7 +2361,7 @@ fn lock_conflicting_extra_basic() -> Result<()> { | |
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| error: extra `project1`, extra `project2` are incompatible with the declared conflicts: {`project[project1]`, `project[project2]`} | ||
| error: Extras `project1` and `project2` are incompatible with the declared conflicts: {`project[project1]`, `project[project2]`} | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Capitalizing here feels a bit off but we do capitalize everywhere else... |
||
| "###); | ||
| // As should exporting them. | ||
| uv_snapshot!(context.filters(), context.export().arg("--frozen").arg("--all-extras"), @r###" | ||
|
|
@@ -2370,7 +2370,7 @@ fn lock_conflicting_extra_basic() -> Result<()> { | |
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| error: extra `project1`, extra `project2` are incompatible with the declared conflicts: {`project[project1]`, `project[project2]`} | ||
| error: Extras `project1` and `project2` are incompatible with the declared conflicts: {`project[project1]`, `project[project2]`} | ||
| "###); | ||
|
|
||
| Ok(()) | ||
|
|
@@ -2604,7 +2604,7 @@ fn lock_conflicting_extra_multiple_not_conflicting1() -> Result<()> { | |
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| error: extra `project1`, extra `project2` are incompatible with the declared conflicts: {`project[project1]`, `project[project2]`} | ||
| error: Extras `project1` and `project2` are incompatible with the declared conflicts: {`project[project1]`, `project[project2]`} | ||
| "###); | ||
| // project3/project4 conflict! | ||
| uv_snapshot!( | ||
|
|
@@ -2616,7 +2616,7 @@ fn lock_conflicting_extra_multiple_not_conflicting1() -> Result<()> { | |
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| error: extra `project3`, extra `project4` are incompatible with the declared conflicts: {`project[project3]`, `project[project4]`} | ||
| error: Extras `project3` and `project4` are incompatible with the declared conflicts: {`project[project3]`, `project[project4]`} | ||
| "###); | ||
| // ... but project1/project3 does not. | ||
| uv_snapshot!( | ||
|
|
@@ -3759,7 +3759,7 @@ fn lock_conflicting_group_basic() -> Result<()> { | |
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| error: group `project1`, group `project2` are incompatible with the declared conflicts: {`project:project1`, `project:project2`} | ||
| error: Groups `project1` and `project2` are incompatible with the declared conflicts: {`project:project1`, `project:project2`} | ||
| "###); | ||
|
|
||
| Ok(()) | ||
|
|
@@ -3914,7 +3914,7 @@ fn lock_conflicting_group_default() -> Result<()> { | |
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| error: group `project1` (enabled by default), group `project2` are incompatible with the declared conflicts: {`project:project1`, `project:project2`} | ||
| error: Groups `project1` (enabled by default) and `project2` are incompatible with the declared conflicts: {`project:project1`, `project:project2`} | ||
| "###); | ||
|
|
||
| // If the group is explicitly requested, we should still fail, but shouldn't mark it as | ||
|
|
@@ -3925,7 +3925,7 @@ fn lock_conflicting_group_default() -> Result<()> { | |
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| error: group `project1`, group `project2` are incompatible with the declared conflicts: {`project:project1`, `project:project2`} | ||
| error: Groups `project1` and `project2` are incompatible with the declared conflicts: {`project:project1`, `project:project2`} | ||
| "###); | ||
|
|
||
| // If we install via `--all-groups`, we should also avoid marking the group as "enabled by | ||
|
|
@@ -3936,7 +3936,7 @@ fn lock_conflicting_group_default() -> Result<()> { | |
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| error: group `project1`, group `project2` are incompatible with the declared conflicts: {`project:project1`, `project:project2`} | ||
| error: Groups `project1` and `project2` are incompatible with the declared conflicts: {`project:project1`, `project:project2`} | ||
| "###); | ||
|
|
||
| // Disabling the default group should succeed. | ||
|
|
@@ -4153,7 +4153,7 @@ fn lock_conflicting_mixed() -> Result<()> { | |
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| error: group `project1`, extra `project2` are incompatible with the declared conflicts: {`project:project1`, `project[project2]`} | ||
| error: Group `project1` and extra `project2` are incompatible with the declared conflicts: {`project:project1`, `project[project2]`} | ||
| "###); | ||
|
|
||
| Ok(()) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hilariously, there's also
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.
Lol. Do we like that impl more?