Skip to content

Commit

Permalink
Use ruff to format and check code style
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelarnauts committed Jul 17, 2024
1 parent a7e0404 commit 376bd88
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 15 deletions.
44 changes: 33 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
name: "CI"
name: CI

on:
# Run action when pushed to master, or for commits in a pull request.
push:
branches:
- "master"
tags-ignore:
- "**"
- master
pull_request:
branches:
- master

defaults:
run:
shell: bash

jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
checks:
name: Code checks
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12" ]
steps:
- name: "Checkout the repository"
uses: actions/checkout@v3
- name: Check out ${{ github.sha }} from repository ${{ github.repository }}
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install dependencies
run: poetry install --no-interaction

- name: "Check format"
uses: psf/black@stable
- name: Run checks
run: make check
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
check:
@poetry run ruff check

codefix:
@poetry run ruff format
@poetry run ruff check --fix

.PHONY: check codefix
63 changes: 59 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,73 @@
[tool.poetry]
name = "home-assistant-comfoconnect"
version = "0.1.0"
description = ""
version = "0.1.12"
description = "Home Assistant Zehnder ComfoAirQ integration"
authors = ["Michaël Arnauts <[email protected]>"]
readme = "README.md"
packages = [{include = "home_assistant_comfoconnect"}]

[tool.poetry.dependencies]
python = "^3.10"
python = ">=3.12,<3.13"
aiocomfoconnect = "^0.1.11"

[tool.poetry.group.dev.dependencies]
homeassistant = "^2022.12.0"
homeassistant = "^2024.06.0"
ruff = "^0.5.2"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.ruff]
extend-exclude = [
"__pycache__",
"build",
"dist",
]
target-version = "py312"
line-length = 150
src = ["custom_components"]

[tool.ruff.lint]
extend-select = [
"C4",
"D200",
"D201",
"D204",
"D205",
"D206",
"D210",
"D211",
"D213",
"D300",
"D400",
"D402",
"D403",
"D404",
"D419",
"E",
"F",
"G010",
"I001",
"INP001",
"N805",
"PERF101",
"PERF102",
"PERF401",
"PERF402",
"PGH004",
"PGH005",
"PIE794",
"PIE796",
"PIE807",
"PIE810",
"RET502",
"RET503",
"RET504",
"RET505",
"RUF015",
"RUF100",
"S101",
"T20",
"W",
]

0 comments on commit 376bd88

Please sign in to comment.