Arduino Hooks
This project provides pre-commit hooks for arduino command line tooling. This is an un-official project.
Currently, this includes:
- arduino-lint - Linter for checking arduino projects for problems and conformance to conventions.
- arduino-cli - Limited to
compilecalls for verifying arduino code can be compiled.
This project uses CliPy-Hooks, to handle most of the cross-platform, sub-process nastiness.
Getting Started
To configure pre-commit see their official docs for instructions.
To use any of the arduino hooks below you must have the respective executables installed and on path.
If you are running in an environment where putting this on path is difficult, you may pass an --install-dir argument to define the absolute path to the arduino executable.
The hooked tools do not work with individual source files as is done with most pre-commit hooks, as these tools work against complete arduino projects.
By default, the hooks will treat the root directory as the project root, as is typical in arduino repositories.
In cases where this is not true, you can pass a --project-dir argument with the project root path to the hook.
Due to limitations in argparse, it is highly suggested that you pass all arguments with values using --key=value rather than --key value.
Arduino Lint
Sample .pre-commit-config.yaml:
- repo: https://github.com/creatingnull/arduino-hooks
rev: v0.2.0
hooks:
- id: arduino-lint
You can find instructions on how to install arduino-lint and pre-compiled binaries in the official docs.
For convenience this hook recognises the following arguments:
--fail-on-warnflag that will fail on any warning returned by arduino lint. Similar result tocompliance=strictbut even stricter.
You also may pass in supported arduino-cli arguments which will be handed through to the executable.
- repo: https://github.com/creatingnull/arduino-hooks
rev: v0.2.0
hooks:
- id: arduino-lint
- args: ["--install-dir=/opt/arduino/", "--fail-on-warn", "--project-dir=src/"]
Arduino CLI
Sample .pre-commit-config.yaml:
- repo: https://github.com/creatingnull/arduino-hooks
rev: v0.2.0
hooks:
- id: arduino-cli
args: ["--fqbn=arduino:avr:nano"]
You can find instructions on how to install arduino-cli and pre-compiled binaries in the official docs
Must provide the full qualified board name for the target microcontroller, this parameter should be passed in "" quotes due to yaml restrictions on : use.
You'll also need to have previously installed the core for this target and any libs required by your project.
As a Github Action
You can add these hooks to your existing pre-commit workflow by adding a step to install the required dependencies.
See the following example step added to a ubuntu-latest pre-commit workflow:
- name: Install Dependancies
run: |
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-lint/main/etc/install.sh | sh
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
bin/arduino-cli core install arduino:avr
bin/arduino-cli lib install NullPacketComms
echo "${PWD}/bin/" >> $GITHUB_PATH
The process followed is to:
- Install arduino-cli if used
- Install arduino-lint if used
- Install required cores for the arduino-cli hook(s)
- Install required 3rd party libs for the arduino-cli hook(s)
- Put arduino tooling on path
For more information you can check out this project implementing these hooks in a github workflow.
Donations
I just do this stuff for fun in my spare time, but feel free to:
License
The source of this repo uses the MIT open-source license, for details on the current licensing see LICENSE or click the badge above.
Metadata
Release files for arduino-hooks 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| arduino_hooks-0.3.0.tar.gz | 5.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arduino_hooks-0.3.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 12.3 kB
Release files / arduino_hooks-0.3.0.tar.gz
| Download URL | arduino_hooks-0.3.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a68cbfb5496e7f83788f172d14c74cddb1807c57ddd2386f61f4de42f3848283
|
|
BLAKE2b-256 checksum How to use checksums |
868bf46238bb9f5860eed322ef86f37e7fb054649ddc76b1243a9fd5fbc554e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / arduino_hooks-0.3.0-py2.py3-none-any.whl
| Download URL | arduino_hooks-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
65c9668625ba798384fba840544460a46338e453e0e48446895e7dcad3d60cfb
|
|
BLAKE2b-256 checksum How to use checksums |
b66b0aa22eac690a74fe864209ad8261e5e2db92bdc77dc4a0d0917a873d8fc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Security for arduino-hooks 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.