mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
feat(setup): add optional pyright installation and create type-check script
This commit is contained in:
parent
781286216a
commit
5ff61b6d5c
4 changed files with 62 additions and 7 deletions
|
|
@ -10,6 +10,21 @@ requires-python = ">=3.13"
|
|||
[tool.setuptools]
|
||||
packages = ["custom_components.tibber_prices"]
|
||||
|
||||
[tool.pyright]
|
||||
include = ["custom_components/tibber_prices"]
|
||||
exclude = [
|
||||
"**/node_modules",
|
||||
"**/__pycache__",
|
||||
"**/.git",
|
||||
"**/.github",
|
||||
"**/docs",
|
||||
"**/venv",
|
||||
"**/.venv",
|
||||
]
|
||||
venvPath = "."
|
||||
venv = ".venv"
|
||||
typeCheckingMode = "basic"
|
||||
|
||||
[tool.ruff]
|
||||
# Based on https://github.com/home-assistant/core/blob/dev/pyproject.toml
|
||||
target-version = "py313"
|
||||
|
|
@ -18,7 +33,7 @@ line-length = 120
|
|||
[tool.ruff.lint]
|
||||
select = ["ALL"]
|
||||
ignore = [
|
||||
# "ANN101", # Missing type annotation for `self` in method
|
||||
# "ANN101", # Missing type annotation for `self` in method
|
||||
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
|
||||
"D203", # no-blank-line-before-class (incompatible with formatter)
|
||||
"D212", # multi-line-summary-first-line (incompatible with formatter)
|
||||
|
|
|
|||
14
scripts/check
Executable file
14
scripts/check
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
# script/check: Run linting and type checking tools together
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
if [ -z "$VIRTUAL_ENV" ]; then
|
||||
. "$HOME/.venv/bin/activate"
|
||||
fi
|
||||
|
||||
scripts/type-check
|
||||
scripts/lint-check
|
||||
|
|
@ -6,6 +6,15 @@ set -e
|
|||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Install optional pyright for type checking
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
echo "==> Installing pyright for type checking..."
|
||||
npm install -g pyright 2>/dev/null || {
|
||||
echo " ⚠️ Warning: pyright installation failed (optional)"
|
||||
echo " ℹ️ You can install it manually: npm install -g pyright"
|
||||
}
|
||||
fi
|
||||
|
||||
# Install optional release note backend: GitHub Copilot CLI (AI-powered)
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
echo "==> Installing GitHub Copilot CLI for AI-powered release notes..."
|
||||
|
|
|
|||
17
scripts/type-check
Executable file
17
scripts/type-check
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
# script/type-check: Run type checking tools
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
if [ -z "$VIRTUAL_ENV" ]; then
|
||||
. "$HOME/.venv/bin/activate"
|
||||
fi
|
||||
|
||||
echo "==> Running type checking tools..."
|
||||
|
||||
pyright
|
||||
|
||||
echo "==> Type checking completed."
|
||||
Loading…
Reference in a new issue