The open source OpenXR runtime
1#!/bin/sh
2# Copyright 2019-2024, Collabora, Ltd.
3# SPDX-License-Identifier: BSL-1.0
4# Author: Rylie Pavlik <rylie.pavlik@collabora.com>
5
6# Runs "codespell" all the source files in this project.
7# Pass:
8# -i 3
9# as arguments to interactively fix detected issues,
10# including ambiguous ones,
11# rather than only directly fixing the ones it can.
12
13# Success error code if no mistakes or only auto-fixable mistakes found.
14# Failure error code if one or more ambiguous fixes found (requiring interactive fixing).
15
16# See https://github.com/codespell-project/codespell
17# or run pip3 install codespell
18
19set -e
20
21# Comma-delimited list of words for codespell to not try to correct.
22IGNORE_WORDS_LIST="ang,sinc,sie,stoll,wil,daa,localy,od,ser,unknwn,parm,inflight,marge,devault,errorprone,childs"
23IGNORE_REGEX="\b(pEvent|inout|Kimera|InstallIn)\b"
24
25SCRIPTDIR=$(cd "$(dirname "$0")" && pwd)
26
27(
28 cd "$SCRIPTDIR/.."
29 find \
30 ./*.md \
31 doc \
32 scripts/format-*.sh \
33 src/xrt \
34 \( -name "*.c" \
35 -o -name "*.cpp" \
36 -o -name "*.h" \
37 -o -name "*.hpp" \
38 -o -name "*.sh" \
39 -o -name "*.md" \
40 -o -name "*.comp" \
41 -o -name "*.py" \
42 -o -name "*.java" \
43 -o -name "*.kt" \
44 -o -name "*.gradle" \
45 -o -name "CMakeLists.txt" \) \
46 -exec codespell \
47 "--exclude-file=${SCRIPTDIR}/monado-codespell.exclude" \
48 "--ignore-regex=${IGNORE_REGEX}" \
49 --ignore-words-list="${IGNORE_WORDS_LIST}" \
50 -w \
51 "$@" \
52 \{\} +
53)