-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This replaces the codeformat.py script with just running black directly, both from GitHub CI and from pre-commit, same as how we do `ruff`. This allows us to avoid needing to use the system black version for pre-commit, and lets us pin the same version for both. pyproject.toml is now used for configuration. The old codeformat.py is still kept (but now just runs black directly). This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <[email protected]>
- Loading branch information
Showing
5 changed files
with
17 additions
and
104 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
name: Check code formatting | ||
|
||
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
name: Python code formatting with black | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
black: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
- name: Install packages | ||
run: source tools/ci.sh && ci_code_formatting_setup | ||
- name: Run code formatting | ||
run: source tools/ci.sh && ci_code_formatting_run | ||
- name: Check code formatting | ||
run: git diff --exit-code | ||
- run: pip install --user black==23.7.0 | ||
- run: black . |
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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
repos: | ||
- repo: local | ||
- repo: https://github.com/psf/black | ||
rev: 23.7.0 | ||
hooks: | ||
- id: codeformat | ||
name: MicroPython codeformat.py for changed files | ||
entry: tools/codeformat.py -v -f | ||
language: python | ||
- id: black | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.0.280 | ||
rev: v0.1.0 | ||
hooks: | ||
- id: ruff |
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