{"id":15561215,"url":"https://github.com/creatingnull/arduino-hooks","last_synced_at":"2025-04-23T22:24:54.805Z","repository":{"id":38365978,"uuid":"454665397","full_name":"CreatingNull/Arduino-Hooks","owner":"CreatingNull","description":"Arduino cli tool hooks using the pre-commit framework.","archived":false,"fork":false,"pushed_at":"2024-05-13T09:00:46.000Z","size":121,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T22:46:15.683Z","etag":null,"topics":["arduino","arduino-cli","arduino-lint","pre-commit","pre-commit-hooks"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CreatingNull.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-02T06:22:47.000Z","updated_at":"2024-08-19T17:29:15.000Z","dependencies_parsed_at":"2024-04-29T10:26:09.195Z","dependency_job_id":"2b46bf9e-3638-4391-a3f5-a44d572178aa","html_url":"https://github.com/CreatingNull/Arduino-Hooks","commit_stats":{"total_commits":67,"total_committers":2,"mean_commits":33.5,"dds":"0.13432835820895528","last_synced_commit":"5b74c3e32d3bd952a778c95099aadf8d0803e301"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CreatingNull%2FArduino-Hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CreatingNull%2FArduino-Hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CreatingNull%2FArduino-Hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CreatingNull%2FArduino-Hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CreatingNull","download_url":"https://codeload.github.com/CreatingNull/Arduino-Hooks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242254173,"owners_count":20097531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-cli","arduino-lint","pre-commit","pre-commit-hooks"],"created_at":"2024-10-02T16:06:24.000Z","updated_at":"2025-03-06T17:31:48.326Z","avatar_url":"https://github.com/CreatingNull.png","language":"Python","funding_links":["https://www.buymeacoffee.com/nulltek"],"categories":[],"sub_categories":[],"readme":"# ![NullTek Documentation](https://raw.githubusercontent.com/CreatingNull/NullTek-Assets/main/img/logo/NullTekDocumentationLogo.png) Arduino Hooks\n\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/arduino-hooks?style=flat-square\u0026logo=python\u0026logoColor=white)](https://pypi.org/project/arduino-hooks/)\n[![PyPI - Release Version](https://img.shields.io/pypi/v/arduino-hooks?style=flat-square\u0026logo=pypi\u0026logoColor=white)](https://pypi.org/project/arduino-hooks/)\n[![Format](https://img.shields.io/github/actions/workflow/status/CreatingNull/arduino-hooks/run-pre-commit.yaml?branch=main\u0026logo=pre-commit\u0026style=flat-square\u0026label=format)](https://github.com/CreatingNull/arduino-hooks/actions/workflows/run-pre-commit.yaml)\n[![Tests](https://img.shields.io/github/actions/workflow/status/CreatingNull/arduino-hooks/run-tests.yaml?branch=main\u0026logo=GitHub\u0026style=flat-square\u0026label=tests)](https://github.com/CreatingNull/arduino-hooks/actions/workflows/run-tests.yaml)\n[![License](https://img.shields.io/github/license/CreatingNull/arduino-hooks?style=flat-square)](https://github.com/CreatingNull/arduino-hooks/blob/main/LICENSE.md)\n\nThis project provides [pre-commit](https://github.com/pre-commit/pre-commit) hooks for [arduino](https://github.com/arduino) command line tooling.\nThis is an un-official project.\n\nCurrently, this includes:\n\n- [arduino-lint](https://github.com/arduino/arduino-lint) - Linter for checking arduino projects for problems and conformance to conventions.\n- [arduino-cli](https://github.com/arduino/arduino-cli) - Limited to `compile` calls for verifying arduino code can be compiled.\n\nThis project uses [CliPy-Hooks](https://github.com/CreatingNull/clipy-hooks), to handle most of the cross-platform, sub-process nastiness.\n\n______________________________________________________________________\n\n## Getting Started\n\nTo configure pre-commit see [their official docs](https://pre-commit.com/) for instructions.\n\nTo use any of the arduino hooks below you must have the respective executables installed and **on path**.\nIf 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.\n\nThe 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.\nBy default, the hooks will treat the root directory as the project root, as is typical in arduino repositories.\nIn cases where this is not true, you can pass a `--project-dir` argument with the project root path to the hook.\n\nDue to limitations in `argparse`, it is **highly** suggested that you pass all arguments with values using `--key=value` rather than `--key value`.\n\n### Arduino Lint\n\nSample `.pre-commit-config.yaml`:\n\n```yaml\n  - repo: https://github.com/creatingnull/arduino-hooks\n    rev: v0.3.0\n    hooks:\n      - id: arduino-lint\n```\n\nYou can find instructions on how to install `arduino-lint` and pre-compiled binaries in the [official docs](https://arduino.github.io/arduino-lint/latest/installation/).\n\nFor convenience this hook recognises the following arguments:\n\n- `--fail-on-warn` flag that will fail on any warning returned by arduino lint.\n  Similar result to `compliance=strict` but even stricter.\n\nYou also may pass in supported `arduino-cli` [arguments](https://arduino.github.io/arduino-lint/latest/commands/arduino-lint/) which will be handed through to the executable.\n\n```yaml\n  - repo: https://github.com/creatingnull/arduino-hooks\n    rev: v0.3.0\n    hooks:\n      - id: arduino-lint\n      - args: [--install-dir=/opt/arduino/, --fail-on-warn, --project-dir=src/]\n```\n\n### Arduino CLI\n\nSample `.pre-commit-config.yaml`:\n\n```yaml\n  - repo: https://github.com/creatingnull/arduino-hooks\n    rev: v0.3.0\n    hooks:\n      - id: arduino-cli\n        args: [--fqbn=arduino:avr:nano]\n```\n\nYou can find instructions on how to install `arduino-cli` and pre-compiled binaries in the [official docs](https://arduino.github.io/arduino-cli/latest/installation/)\n\nMust provide the full qualified board name for the target microcontroller, this parameter should be passed in `\"\"` quotes due to yaml restrictions on `:` use.\nYou'll also need to have previously installed the [core](https://arduino.github.io/arduino-cli/latest/getting-started/#install-the-core-for-your-board) for this target and any [libs](https://arduino.github.io/arduino-cli/latest/getting-started/#add-libraries) required by your project.\n\n______________________________________________________________________\n\n## As a Github Action\n\nYou can add these hooks to your existing pre-commit workflow by adding a step to install the required dependencies.\n\nSee the following example step added to a `ubuntu-latest` pre-commit workflow:\n\n```yaml\n  - name: Install Dependencies\n    run: |\n      curl -fsSL https://raw.githubusercontent.com/arduino/arduino-lint/main/etc/install.sh | sh\n      curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh\n      bin/arduino-cli core install arduino:avr\n      bin/arduino-cli lib install NullPacketComms\n      echo \"${PWD}/bin/\" \u003e\u003e $GITHUB_PATH\n```\n\nThe process followed is to:\n\n1. Install arduino-cli if used\n2. Install arduino-lint if used\n3. Install required cores for the arduino-cli hook(s)\n4. Install required 3rd party libs for the arduino-cli hook(s)\n5. Put arduino tooling on path\n\nFor more information you can check out [this project](https://github.com/CreatingNull/UOS-Arduino/blob/main/.github/workflows/run-pre-commit.yaml) implementing these hooks in a github workflow.\n\n______________________________________________________________________\n\n## Donations\n\nI just do this stuff for fun in my spare time, but feel free to:\n\n[![Support via buymeacoffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/nulltek)\n\n______________________________________________________________________\n\n## License\n\nThe source of this repo uses the MIT open-source license, for details on the current licensing see [LICENSE](https://github.com/CreatingNull/arduino-hooks/blob/main/LICENSE.md) or click the badge above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreatingnull%2Farduino-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreatingnull%2Farduino-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreatingnull%2Farduino-hooks/lists"}