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

Add support for ruff-ecosystem format comparisons with black #8419

Merged
merged 2 commits into from
Nov 2, 2023

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Nov 1, 2023

Extends #8416 activating the black-and-ruff and black-then-ruff formatter comparison modes for ecosystem checks allowing us to compare changes to Black across the ecosystem.

@zanieb zanieb added the internal An internal refactor or improvement label Nov 1, 2023
Copy link
Contributor

github-actions bot commented Nov 1, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no linter changes.

✅ ecosystem check detected no format changes.

scripts/check_ecosystem.py Outdated Show resolved Hide resolved
scripts/check_ecosystem.py Outdated Show resolved Hide resolved
@zanieb zanieb marked this pull request as ready for review November 1, 2023 20:59
Base automatically changed from zanie/eco-format-cmp to main November 2, 2023 01:20
zanieb added a commit that referenced this pull request Nov 2, 2023
Previously, the ecosystem checks formatted with the baseline then
formatted again with `--diff` to get the changed files.

Now, the ecosystem checks support a new mode where we:
- Format with the baseline
- Commit the changes
- Reset to the target ref
- Format again
- Check the diff from the baseline commit

This effectively tests Ruff changes on unformatted code rather than
changes in previously formatted code (unless, of course, the project is
already using Ruff).

While this mode is the new default, I've retained the old one for local
checks. The mode can be toggled with `--format-comparison <type>`.

Includes some more aggressive resetting of the GitHub repositories when
cached.

Here, I've also stubbed comparison modes in which `black` is used as the
baseline. While these do nothing here, #8419 adds support.

I tested this with the commit from #8216 and ecosystem changes appear
https://gist.github.com/zanieb/a982ec8c392939043613267474471a6e
@zanieb zanieb enabled auto-merge (squash) November 2, 2023 01:22
@zanieb zanieb merged commit ebad36d into main Nov 2, 2023
16 checks passed
@zanieb zanieb deleted the zanie/eco-cmp-black branch November 2, 2023 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants