Skip to content

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

Merged
zanieb merged 2 commits into
mainfrom
zanie/eco-cmp-black
Nov 2, 2023
Merged

zanieb merged 2 commits into
mainfrom
zanie/eco-cmp-black

Conversation

@zanieb

@zanieb zanieb commented Nov 1, 2023 •

Copy link
Copy Markdown
Member

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 requested review from MichaReiser and konstin November 1, 2023 18:46
@zanieb zanieb added the internal An internal refactor or improvement (not for changelogs) label Nov 1, 2023
@zanieb
zanieb force-pushed the zanie/eco-cmp-black branch from 5b4a1be to defb90e Compare November 1, 2023 18:56
@github-actions

github-actions Bot commented Nov 1, 2023 •

Copy link
Copy Markdown
Contributor

PR Check Results

Ecosystem

✅ ecosystem check detected no linter changes.

✅ ecosystem check detected no format changes.

@zanieb
zanieb force-pushed the zanie/eco-cmp-black branch 2 times, most recently from 5a46f1b to 54a3d68 Compare November 1, 2023 20:27
Comment thread scripts/check_ecosystem.py Resolved
Comment thread scripts/check_ecosystem.py Resolved
@zanieb
zanieb marked this pull request as ready for review November 1, 2023 20:59
@zanieb
zanieb force-pushed the zanie/eco-format-cmp branch from 82c8405 to eef3b25 Compare November 2, 2023 01:14
@zanieb
zanieb force-pushed the zanie/eco-cmp-black branch from dfb9960 to f422ee1 Compare November 2, 2023 01:18
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 force-pushed the zanie/eco-cmp-black branch from f422ee1 to 85cef61 Compare November 2, 2023 01:21
@zanieb
zanieb enabled auto-merge (squash) November 2, 2023 01:22
@zanieb
zanieb merged commit ebad36d into main Nov 2, 2023
@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 (not for changelogs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants