blob: 3d9c8482b0f818d2b95370350d3a02f5fdfd727c [file] [edit]
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
#
# SPDX-License-Identifier: Unlicense
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: trailing-whitespace
exclude: |
(?x)^(
hw/bsp/mcx/sdk/
)
- id: end-of-file-fixer
exclude: |
(?x)^(
.idea/|
hw/bsp/mcx/sdk/
)
- id: forbid-submodules
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args: [-w]
exclude: |
(?x)^(
lib/|
hw/bsp/mcx/sdk/
)
- repo: local
hooks:
- id: unique-example-pids
name: unique example USB PIDs
files: usb_descriptors\.c$
entry: python3 tools/check_example_pids.py
pass_filenames: false
language: system
- id: unit-test
name: unit-test
files: ^(src/|test/unit-test/)
entry: sh -c "cd test/unit-test && ceedling test:all"
pass_filenames: false
types_or: [c, header]
language: system
# Two hooks, split by what each suite actually reads. The full discovery run costs
# ~55s (deliberate hang/timeout simulations); only test_hil_select (~0.1s) reads
# hw/bsp (board.cmake), src (portable dirs + class include graph) and examples
# (tusb_config.h per test) -- renaming a board, port dir or example breaks it without
# touching test/hil, and catching that here beats waiting for pre-commit CI.
# No types_or: the rig rosters (*.json) are inputs too.
# examples/device/mtp/src is in scope: test_hil_bounded parses README_TXT_CONTENT
# and md5-checks the logo header from there as its MTP fixtures.
- id: hil-test
name: hil-test
files: ^(test/hil/|examples/device/mtp/src/)
entry: python3 -m unittest discover -s test/hil/test
pass_filenames: false
language: system
- id: hil-select-test
name: hil-select-test
files: ^(hw/bsp/|src/|examples/)
entry: python3 test/hil/test/test_hil_select.py
pass_filenames: false
language: system
# - id: build-fuzzer
# name: build-fuzzer
# files: ^(src/|test/fuzz/)
# language: system
# types_or: [c, header]
# entry: |
# bash -c 'export CC=clang
# export CXX=clang++
# fuzz_harness=$(ls -d test/fuzz/device/*/)
# for h in $fuzz_harness
# do
# make -C $h get-deps
# make -C $h all
# done'