-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (72 loc) · 2.38 KB
/
Makefile
File metadata and controls
85 lines (72 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Makefile for BMW Wallbox Home Assistant Integration
# Quick commands for development
.PHONY: help install lint format test coverage clean
help:
@echo "BMW Wallbox Development Commands:"
@echo ""
@echo " make install Install development dependencies"
@echo " make lint Run all linters (ruff, mypy)"
@echo " make format Auto-format code with ruff"
@echo " make test Run all tests"
@echo " make coverage Run tests with coverage report"
@echo " make clean Remove generated files"
@echo " make pre-commit Install pre-commit hooks"
@echo " make check Run all checks (lint + test)"
@echo " make fix Auto-fix common issues"
@echo " make clean-whitespace Remove trailing whitespace and blank lines"
@echo ""
install:
pip install -r requirements-dev.txt
lint:
@echo "Running Ruff linter..."
ruff check custom_components/ tests/
@echo ""
@echo "Checking code formatting..."
ruff format custom_components/ tests/ --check
@echo ""
@echo "Running MyPy type checker..."
mypy custom_components/bmw_wallbox --show-error-codes --pretty
format:
@echo "Formatting code with Ruff..."
ruff check custom_components/ tests/ --fix
ruff format custom_components/ tests/
@echo "✓ Code formatted!"
test:
@echo "Running tests..."
pytest tests/ -v
coverage:
@echo "Running tests with coverage..."
pytest tests/ --cov=custom_components.bmw_wallbox --cov-report=html --cov-report=term-missing
@echo ""
@echo "Coverage report generated in htmlcov/index.html"
clean:
@echo "Cleaning up..."
rm -rf __pycache__
rm -rf .pytest_cache
rm -rf .mypy_cache
rm -rf .ruff_cache
rm -rf htmlcov
rm -rf .coverage
rm -rf build
rm -rf dist
rm -rf *.egg-info
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
@echo "✓ Cleaned!"
pre-commit:
@echo "Installing pre-commit hooks..."
pre-commit install
@echo "✓ Pre-commit hooks installed!"
@echo "Run 'pre-commit run --all-files' to test"
check: lint test
@echo ""
@echo "✓ All checks passed!"
# Quick fix common issues
fix:
@echo "Auto-fixing common issues..."
ruff check custom_components/ tests/ --fix
ruff format custom_components/ tests/
@echo "✓ Fixed!"
# Remove trailing whitespace and fix blank lines
clean-whitespace: format
@echo "✓ Whitespace cleaned by ruff format!"