Skip to content

Commit c35d3af

Browse files
authored
Merge pull request #144 from 2bndy5/pre-commit
chore(dev): adopt pre-commit hooks
2 parents da29af3 + 93ffca3 commit c35d3af

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-FileCopyrightText: 2026 Brendan Doherty
2+
#
3+
# SPDX-License-Identifier: MIT
4+
name: Pre-commit Hooks
5+
6+
on: [push]
7+
8+
# Do not inherit GITHUB_TOKEN permissions, for security purposes.
9+
# These will be explicitly granted per job (if/when needed)
10+
permissions: {}
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v6
17+
with:
18+
persist-credentials: false
19+
- name: Set up Python
20+
uses: actions/setup-python@v6
21+
id: setup-python
22+
with:
23+
python-version: '3.x'
24+
- name: Cache pre-commit venv
25+
uses: actions/cache@v5
26+
with:
27+
path: ~/.cache/pre-commit
28+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}-${{ steps.setup-python.outputs.python-version }}
29+
- name: Run pre-commit
30+
run: >-
31+
pipx run
32+
pre-commit run
33+
--all-files
34+
--show-diff-on-failure
35+
--color always

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-FileCopyrightText: 2024 Justin Myers , written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v6.0.0
8+
hooks:
9+
- id: check-yaml
10+
- id: end-of-file-fixer
11+
- id: trailing-whitespace
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: v0.14.14
14+
hooks:
15+
- id: ruff-format
16+
- id: ruff-check
17+
args: ["--fix"]
18+
- repo: https://github.com/fsfe/reuse-tool
19+
rev: v6.2.0
20+
hooks:
21+
- id: reuse

LICENSES/Unlicense.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
4+
5+
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and
6+
successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
7+
8+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9+
10+
For more information, please refer to <http://unlicense.org/>

0 commit comments

Comments
 (0)