-
Notifications
You must be signed in to change notification settings - Fork 1
tooling: Add Makefile and npm hooks for dev workflow. #229
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
Changes from 1 commit
3761702
ba7feea
7122f59
833a85f
bd6339f
f089246
214fca4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| npx --no-install commitlint --edit "$1" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| npx --no-install validate-branch-name && npx --no-install git-precommit-checks && npx --no-install lint-staged | ||
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,64 @@ | ||||||
| .DEFAULT_GOAL := help | ||||||
|
|
||||||
| PORT ?= /dev/ttyACM0 | ||||||
|
|
||||||
| # --- Development setup --- | ||||||
|
|
||||||
| .PHONY: install | ||||||
| install: ## Install dev tools and git hooks | ||||||
| pip install ruff pytest | ||||||
|
||||||
| pip install ruff pytest | |
| python3 -m pip install -r .github/workflows/requirements.txt mpremote |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Install PyYAML in dev setup target
make install currently installs only ruff and pytest, but the test suite imports yaml (for example in tests/conftest.py and tests/test_scenarios.py). On a fresh environment, following this new workflow causes make test to fail with ModuleNotFoundError: No module named 'yaml', so the advertised setup target does not actually provision the dependencies needed for testing.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Install Python tools with the same interpreter used for tests
The Makefile installs dependencies with bare pip but runs tests with python3 -m pytest; on systems where pip targets a different interpreter (or is missing while only pip3 exists), make install succeeds/fails inconsistently and make test can still raise missing-module errors. Installing via python3 -m pip keeps the environment aligned with the test runner.
Useful? React with 👍 / 👎.
Copilot
AI
Mar 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pip install -e ... can pick up the wrong Python environment (e.g., if pip points to a different interpreter than python3). Using python3 -m pip install -e ... (or $(PYTHON) -m pip with a configurable PYTHON var) makes the install target more reliable.
Copilot
AI
Mar 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test-driver uses -k "$(DRIVER)", but this test suite already provides a dedicated --driver option in tests/conftest.py. Using -k will match substrings in nodeids and may select the wrong set of tests (or none). Switch this to --driver $(DRIVER) to match the documented/implemented driver filter.
| python3 -m pytest tests/ -v -k "$(DRIVER)" --port $(PORT) -s | |
| python3 -m pytest tests/ -v --driver $(DRIVER) --port $(PORT) -s |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,53 @@ | ||||||
| module.exports = { | ||||||
| extends: ['@commitlint/config-conventional'], | ||||||
| rules: { | ||||||
| 'subject-case': [0], | ||||||
| 'subject-full-stop': [0], | ||||||
| 'header-max-length': [2, 'always', 78], | ||||||
| 'scope-enum': [ | ||||||
| 1, | ||||||
|
||||||
| 1, | |
| 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow existing scope-only commit subjects
The new type-enum restricts the leading token to conventional types and excludes driver scopes (e.g. hts221, ism330dl), so commit messages in the repository’s established <scope>: <Description.> format are rejected by the new commit-msg hook. This blocks contributors using the documented/project-native format unless they switch to a different convention, which creates workflow breakage.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Husky hook file doesn’t include a shebang (e.g.
#!/usr/bin/env sh). Depending on platform and how Git executes the hook, a missing shebang can cause the hook to fail to run. Add the standard Husky header (and any required initialization for your Husky major version) so the hook executes reliably.