Skip to content
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 4 commits into from Jan 25, 2023
Merged

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Jan 25, 2023

Computers are really bad at some things, but one thing they're really good at is counting :)

So let's replace:

$ ruff 1.py
1.py:1:89: E501 Line too long (115 > 88 characters)
Found 1 error(s).
$ ruff 2.py
2.py:1:89: E501 Line too long (115 > 88 characters)
2.py:2:89: E501 Line too long (115 > 88 characters)
Found 2 error(s).

With:

$ target/debug/ruff 1.py
warning: debug build without --no-cache.
1.py:1:89: E501 Line too long (115 > 88 characters)
Found 1 error.
$ target/debug/ruff 2.py
warning: debug build without --no-cache.
2.py:1:89: E501 Line too long (115 > 88 characters)
2.py:2:89: E501 Line too long (115 > 88 characters)
Found 2 errors.

Also some CI updates:

@charliermarsh
Copy link
Member

This is awesome. Will merge soon. I want to get the Windows compatibility PR in first. Then, I'm happy to help rebase this if there are any conflicts.

@charliermarsh charliermarsh self-requested a review January 25, 2023 15:20
@not-my-profile
Copy link
Contributor

Yeah I agree, nice changes! Since these are separate changes, I think merging by rebase would be in order.

@charliermarsh charliermarsh merged commit 2334159 into astral-sh:main Jan 25, 2023
@hugovk hugovk deleted the fix-errors branch January 25, 2023 20:31
branches: [main]
pull_request:
branches: [main]
on: [push, pull_request, workflow_dispatch]
Copy link
Contributor

@andersk andersk Jan 25, 2023

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 the pull_request event in the base repository.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor

@andersk andersk Jan 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d recommend

on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

Copy link
Contributor Author

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?

    # We want to run on external PRs, but not on our own internal PRs as they'll be run
    # by the push to the branch.
    if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

re: https://github.com/has2k1/plotnine/blob/f696c01f1602e422a29778c112005463992ed707/.github/workflows/testing.yml#L10-L12

Copy link
Contributor

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.

Copy link
Contributor Author

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-:

on:
  push:
    branches: [main, 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

Copy link
Contributor

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.

andersk added a commit to andersk/ruff that referenced this pull request Jan 25, 2023
charliermarsh pushed a commit that referenced this pull request Jan 25, 2023
#2157 (comment)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
writeln!(
stdout,
"Found {total} error(s) ({fixed} fixed, {remaining} remaining)."
"Found {total} error{s}) ({fixed} fixed, {remaining} remaining)."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renovate bot added a commit to ixm-one/pytest-cmake-presets that referenced this pull request Jan 26, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://togithub.com/charliermarsh/ruff) | `^0.0.231` ->
`^0.0.235` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.235/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.235/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.235/compatibility-slim/0.0.231)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.235/confidence-slim/0.0.231)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.235`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.235)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.234...v0.0.235)

#### Summary

Follow-up release to `v0.0.234` to fix two non-fatal issues related to
CLI output.

(No new rules or functionality.)

#### What's Changed

- Avoid duplicate CI runs triggered by pushes to pull requests by
[@&#8203;andersk](https://togithub.com/andersk) in
[astral-sh/ruff#2178
- Restore single-file license by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2180
- Windows compatibility by
[@&#8203;sbrugman](https://togithub.com/sbrugman) in
[astral-sh/ruff#2033
- Remove stray parenthesis from fixed errors message by
[@&#8203;andersk](https://togithub.com/andersk) in
[astral-sh/ruff#2181
- Fix conflicting error message warning by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2182

**Full Changelog**:
astral-sh/ruff@v0.0.234...v0.0.235

###
[`v0.0.234`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.234)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.233...v0.0.234)

#### What's Changed

- Move is_overlong to helpers by
[@&#8203;ericroberts](https://togithub.com/ericroberts) in
[astral-sh/ruff#2137
- Update .pre-commit-config.yml by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[astral-sh/ruff#2139
- Avoid generating dirty call paths by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2144
- Implement runtime-import-in-type-checking-block (TYP004) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2146
- Implement typing-only import detection (TYP001, TYP002, TYP003) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2147
- Add `#![warn(clippy::pedantic)]` to lib.rs and main.rs files by
[@&#8203;not-my-profile](https://togithub.com/not-my-profile) in
[astral-sh/ruff#2148
- Treat Python 3.7 as minimum supported version by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2159
- Avoid flagging unused loop variable (B007) with locals() by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2161
- Avoid prefer-type-error (TRY004) with intermediary control flow by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2162
- Add an FAQ on autofix by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2163
- Avoid re-resolving settings for repeated paths by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2165
- Suggest input format in error case by
[@&#8203;spaceone](https://togithub.com/spaceone) in
[astral-sh/ruff#2167
- Re-add error wrapper in main.rs by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2168
- fix: avoid flagging unused loop variable (B007) with globals(), vars()
or eval() by [@&#8203;spaceone](https://togithub.com/spaceone) in
[astral-sh/ruff#2166
- Fix singular and plural for "error(s)" by
[@&#8203;hugovk](https://togithub.com/hugovk) in
[astral-sh/ruff#2157
- Add Babel to readme by [@&#8203;akx](https://togithub.com/akx) in
[astral-sh/ruff#2170
- Add flake8-builtins options to README by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2173
- Avoid reraise-no-cause for explicit reraises by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2174
- Rename TYP rules to TYC by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2175
- Actually, rename TYP rules to TCH by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2176

**Full Changelog**:
astral-sh/ruff@v0.0.233...v0.0.234

###
[`v0.0.233`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.233)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.231...v0.0.233)

This is a rerun of `v0.0.232` (unreleased) to address build failures on
Windows.

#### What's Changed

- Move compare to helpers file by
[@&#8203;ericroberts](https://togithub.com/ericroberts) in
[astral-sh/ruff#2131
- Enable executable checks on Windows by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#2133

**Full Changelog**:
astral-sh/ruff@v0.0.232...v0.0.233

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMTEuMSIsInVwZGF0ZWRJblZlciI6IjM0LjExMS4xIn0=-->

Signed-off-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants