8000 Add a pre-commit configuration to enforce basic file hygiene. · jensechu/circuitpython@79cd864 · GitHub
[go: up one dir, main page]

Skip to content

Commit 79cd864

Browse files
committed
Add a pre-commit configuration to enforce basic file hygiene.
1 parent dd5d7c8 commit 79cd864

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.github/workflows/pre-commit.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2019 Anthony Sottile
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: pre-commit
6+
7+
on:
8+
pull_request:
9+
push:
10+
branches: [master]
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v1
17+
- uses: actions/setup-python@v1
18+
- name: set PY
19+
run: echo "::set-env name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
20+
- uses: actions/cache@v1
21+
with:
22+
path: ~/.cache/pre-commit
23+
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
24+
- uses: pre-commit/action@v1.1.0

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v2.3.0
8+
hooks:
9+
- id: check-yaml
10+
- id: end-of-file-fixer
11+
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)'
12+
- id: trailing-whitespace
13+
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)'

0 commit comments

Comments
 (0)
0