Skip to content

Run ruff ci but ignore errors #296

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,22 @@ jobs:
uses: hacs/action@main
with:
category: integration

lint-ruff:
name: Ruff validation
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Run ruff format
uses: astral-sh/ruff-action@v3
with:
args: format --diff
src: "."

- name: Run ruff check
uses: astral-sh/ruff-action@v3
with:
args: check --exit-zero # succeed despite errors until https://github.com/custom-components/zaptec/issues/258 is done
src: "."
12 changes: 9 additions & 3 deletions custom_components/zaptec/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,17 @@ async def service_handle_limit_current(service_call: ServiceCall) -> None:
# only add the relevant arguments if they are not None
if (available_current := service_call.data.get("available_current")) is not None:
limit_args["availableCurrent"] = available_current
if (available_current_phase1 := service_call.data.get("available_current_phase1")) is not None:
if (
available_current_phase1 := service_call.data.get("available_current_phase1")
) is not None:
limit_args["availableCurrentPhase1"] = available_current_phase1
if (available_current_phase2 := service_call.data.get("available_current_phase2")) is not None:
if (
available_current_phase2 := service_call.data.get("available_current_phase2")
) is not None:
limit_args["availableCurrentPhase2"] = available_current_phase2
if (available_current_phase3 := service_call.data.get("available_current_phase3")) is not None:
if (
available_current_phase3 := service_call.data.get("available_current_phase3")
) is not None:
limit_args["availableCurrentPhase3"] = available_current_phase3
for coordinator, obj in iter_objects(service_call, mustbe=Installation):
_LOGGER.debug(" >> to %s", obj.id)
Expand Down
12 changes: 10 additions & 2 deletions scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@ set -e

cd "$(dirname "$0")/.."

ruff format .
ruff check . --fix
if [ "$1" = "ci" ]; then
# Don't try to fix errors, just fail
ruff format . --diff
ruff check . --exit-zero # succeed despite errors until https://github.com/custom-components/zaptec/issues/258 is done
# ruff check .
else
# Auto-fix as much as possible
ruff format .
ruff check . --fix
fi
Loading