forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch formatting from black to ruff-format (home-assistant#102893)
Co-authored-by: Franck Nijhof <[email protected]>
- Loading branch information
Showing
161 changed files
with
531 additions
and
608 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,6 @@ env: | |
CACHE_VERSION: 5 | ||
PIP_CACHE_VERSION: 4 | ||
MYPY_CACHE_VERSION: 6 | ||
BLACK_CACHE_VERSION: 1 | ||
HA_SHORT_VERSION: "2023.12" | ||
DEFAULT_PYTHON: "3.11" | ||
ALL_PYTHON_VERSIONS: "['3.11', '3.12']" | ||
|
@@ -58,7 +57,6 @@ env: | |
POSTGRESQL_VERSIONS: "['postgres:12.14','postgres:15.2']" | ||
PRE_COMMIT_CACHE: ~/.cache/pre-commit | ||
PIP_CACHE: /tmp/pip-cache | ||
BLACK_CACHE: /tmp/black-cache | ||
SQLALCHEMY_WARN_20: 1 | ||
PYTHONASYNCIODEBUG: 1 | ||
HASS_CI: 1 | ||
|
@@ -261,8 +259,8 @@ jobs: | |
. venv/bin/activate | ||
pre-commit install-hooks | ||
lint-black: | ||
name: Check black | ||
lint-ruff-format: | ||
name: Check ruff-format | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- info | ||
|
@@ -276,13 +274,6 @@ jobs: | |
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
check-latest: true | ||
- name: Generate partial black restore key | ||
id: generate-black-key | ||
run: | | ||
black_version=$(cat requirements_test_pre_commit.txt | grep black | cut -d '=' -f 3) | ||
echo "version=$black_version" >> $GITHUB_OUTPUT | ||
echo "key=black-${{ env.BLACK_CACHE_VERSION }}-$black_version-${{ | ||
env.HA_SHORT_VERSION }}-$(date -u '+%Y-%m-%dT%H:%M:%s')" >> $GITHUB_OUTPUT | ||
- name: Restore base Python virtual environment | ||
id: cache-venv | ||
uses: actions/cache/[email protected] | ||
|
@@ -301,33 +292,17 @@ jobs: | |
key: >- | ||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ | ||
needs.info.outputs.pre-commit_cache_key }} | ||
- name: Restore black cache | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ env.BLACK_CACHE }} | ||
key: >- | ||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ | ||
steps.generate-black-key.outputs.key }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-black-${{ | ||
env.BLACK_CACHE_VERSION }}-${{ steps.generate-black-key.outputs.version }}-${{ | ||
env.HA_SHORT_VERSION }}- | ||
- name: Run black (fully) | ||
if: needs.info.outputs.test_full_suite == 'true' | ||
env: | ||
BLACK_CACHE_DIR: ${{ env.BLACK_CACHE }} | ||
- name: Run ruff-format (fully) | ||
run: | | ||
. venv/bin/activate | ||
pre-commit run --hook-stage manual black --all-files --show-diff-on-failure | ||
- name: Run black (partially) | ||
pre-commit run --hook-stage manual ruff-format --all-files --show-diff-on-failure | ||
- name: Run ruff-format (partially) | ||
if: needs.info.outputs.test_full_suite == 'false' | ||
shell: bash | ||
env: | ||
BLACK_CACHE_DIR: ${{ env.BLACK_CACHE }} | ||
run: | | ||
. venv/bin/activate | ||
shopt -s globstar | ||
pre-commit run --hook-stage manual black --files {homeassistant,tests}/components/${{ needs.info.outputs.integrations_glob }}/{*,**/*} --show-diff-on-failure | ||
pre-commit run --hook-stage manual ruff-format --files {homeassistant,tests}/components/${{ needs.info.outputs.integrations_glob }}/{*,**/*} --show-diff-on-failure | ||
lint-ruff: | ||
name: Check 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
"recommendations": ["esbenp.prettier-vscode", "ms-python.python"] | ||
"recommendations": [ | ||
"charliermarsh.ruff", | ||
"esbenp.prettier-vscode", | ||
"ms-python.python" | ||
] | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.