diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2023-10-21 17:40:27 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-11-03 13:30:38 +1100 |
commit | 303ccca7c62bd48b9f6a519549caf0d0f3d2624e (patch) | |
tree | 3957164f749abc13527add3647afd3439c50a04e /.github | |
parent | 7ad84e0422a521fe97ce5d742df280c6b8a3ff87 (diff) | |
download | micropython-303ccca7c62bd48b9f6a519549caf0d0f3d2624e.tar.gz micropython-303ccca7c62bd48b9f6a519549caf0d0f3d2624e.zip |
all: Replace "black" with "ruff format".
- Add config for [tool.ruff.format] to pyproject.toml.
- Update pre-commit to run both ruff and ruff-format (and only check C
files when running codeformat.py)
- Update CI.
- Simplify codeformat.py to remove all the Python-specific logic (just run
"ruff format" directly).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/code_formatting.yml | 4 | ||||
-rw-r--r-- | .github/workflows/ruff.yml | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/.github/workflows/code_formatting.yml b/.github/workflows/code_formatting.yml index cab0ae55b2..53055a8441 100644 --- a/.github/workflows/code_formatting.yml +++ b/.github/workflows/code_formatting.yml @@ -13,9 +13,9 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 - name: Install packages - run: source tools/ci.sh && ci_code_formatting_setup + run: source tools/ci.sh && ci_c_code_formatting_setup - name: Run code formatting - run: source tools/ci.sh && ci_code_formatting_run + run: source tools/ci.sh && ci_c_code_formatting_run - name: Check code formatting run: git diff --exit-code diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 0374d766f5..1159a1882d 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -1,10 +1,11 @@ # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python code lint with ruff +name: Python code lint and formatting with ruff on: [push, pull_request] jobs: ruff: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: pip install --user ruff==0.1.0 + - run: pip install --user ruff==0.1.3 - run: ruff check --output-format=github . + - run: ruff format --diff . |