-
Notifications
You must be signed in to change notification settings - Fork 888
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
Fix singular and plural for "error(s)" #2157
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -96,12 +96,14 @@ impl<'a> Printer<'a> { | |
let remaining = diagnostics.messages.len(); | ||
let total = fixed + remaining; | ||
if fixed > 0 { | ||
let s = if total == 1 { "" } else { "s" }; | ||
writeln!( | ||
stdout, | ||
"Found {total} error(s) ({fixed} fixed, {remaining} remaining)." | ||
"Found {total} error{s}) ({fixed} fixed, {remaining} remaining)." | ||
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. |
||
)?; | ||
} else if remaining > 0 { | ||
writeln!(stdout, "Found {remaining} error(s).")?; | ||
let s = if remaining == 1 { "" } else { "s" }; | ||
writeln!(stdout, "Found {remaining} error{s}.")?; | ||
} | ||
|
||
if !matches!(self.autofix, fix::FixMode::Apply) { | ||
|
@@ -121,10 +123,11 @@ impl<'a> Printer<'a> { | |
Violations::Hide => { | ||
let fixed = diagnostics.fixed; | ||
if fixed > 0 { | ||
let s = if fixed == 1 { "" } else { "s" }; | ||
if matches!(self.autofix, fix::FixMode::Apply) { | ||
writeln!(stdout, "Fixed {fixed} error(s).")?; | ||
writeln!(stdout, "Fixed {fixed} error{s}.")?; | ||
} else if matches!(self.autofix, fix::FixMode::Diff) { | ||
writeln!(stdout, "Would fix {fixed} error(s).")?; | ||
writeln!(stdout, "Would fix {fixed} error{s}.")?; | ||
} | ||
} | ||
} | ||
|
@@ -339,8 +342,13 @@ impl<'a> Printer<'a> { | |
} | ||
|
||
if self.log_level >= &LogLevel::Default { | ||
let s = if diagnostics.messages.len() == 1 { | ||
"" | ||
} else { | ||
"s" | ||
}; | ||
notify_user!( | ||
"Found {} error(s). Watching for file changes.", | ||
"Found {} error{s}. Watching for file changes.", | ||
diagnostics.messages.len() | ||
); | ||
} | ||
|
This file contains 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
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.
The issue with this configuration is that it always results in duplicate CI runs for pull requests: once for the
push
event in the head repository and once for thepull_request
event in the base repository.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.
Yes, I think that's fine.
First, so contributors can see test results it on their forks first, to make sure it passes before proceeding; and then again for the base repo, so the test results can be seen by maintainers in the PR.
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.
Hmm, yeah, this actually does seem non-ideal, since PRs in the main repo are now showing all the duplicate tasks. It'd be nice to at least get rid of those somehow.
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’d recommend
and in the unusual case where a contributor wants to run CI on their fork before creating a pull request,
workflow_dispatch
allows them to trigger it manually.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.
Thank you.
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.
Hi!
workflow_dispatch
is good for manual triggers, but as a contributor who wants to test my code on CI before opening PRs, the amount of clicks it requires to start each build is pretty tedious. And CI should be automatic not manual.CIs are amazing things - you can automatically test and lint your code on all these different versions! We should encourage contributors to use them. But if they don't want to, that's fine, and GitHub Actions is normally disabled for forks.
As another approach, how does this config look?
re: https://github.com/has2k1/plotnine/blob/f696c01f1602e422a29778c112005463992ed707/.github/workflows/testing.yml#L10-L12
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 really see the problem with having to open a PR to run the CI ... you can open the PR as a draft and mark it as ready once the CI has passed if you care about that.
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.
One reason is to avoid noise on the tracker, for example, there may be lots of commits/rebases etc as things progress.
Another option is to follow the lead of things like pytest and pre-commit, and run the CI for branches prefixed with
test-me-
:https://github.com/pytest-dev/pytest/blob/ca40380e99c2cdaab1d0c041f9f28cff37ef8ff9/.github/workflows/test.yml#L3-L16
https://github.com/pre-commit/pre-commit/blob/dd8e717ed6022209a2b0cecf5c75460eb60e548e/.github/workflows/main.yml#L3-L5
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.
You could open a PR in your own fork.