monado/scripts/codespell-project.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.7 KiB
Bash
Raw Normal View History

2019-06-18 16:15:30 +00:00
#!/bin/sh
# Copyright 2019-2024, Collabora, Ltd.
2019-06-18 16:15:30 +00:00
# SPDX-License-Identifier: BSL-1.0
2023-11-15 17:09:51 +00:00
# Author: Rylie Pavlik <rylie.pavlik@collabora.com>
2019-06-18 16:15:30 +00:00
# Runs "codespell" all the source files in this project.
# Pass:
# -i 3
# as arguments to interactively fix detected issues,
# including ambiguous ones,
2022-05-17 22:04:59 +00:00
# rather than only directly fixing the ones it can.
2019-06-18 16:15:30 +00:00
# Success error code if no mistakes or only auto-fixable mistakes found.
# Failure error code if one or more ambiguous fixes found (requiring interactive fixing).
# See https://github.com/codespell-project/codespell
2022-05-17 22:04:59 +00:00
# or run pip3 install codespell
2019-06-18 16:15:30 +00:00
set -e
# Comma-delimited list of words for codespell to not try to correct.
IGNORE_WORDS_LIST="ang,sinc,sie,stoll,wil,daa,localy,od,ser,unknwn,parm,inflight,marge,devault,errorprone,childs"
IGNORE_REGEX="\b(pEvent|inout|Kimera|InstallIn)\b"
2019-06-18 16:15:30 +00:00
2023-02-08 23:36:19 +00:00
SCRIPTDIR=$(cd "$(dirname "$0")" && pwd)
2019-06-18 16:15:30 +00:00
(
2023-02-08 23:36:19 +00:00
cd "$SCRIPTDIR/.."
2019-06-18 16:15:30 +00:00
find \
2023-02-08 23:36:19 +00:00
./*.md \
2019-06-18 16:15:30 +00:00
doc \
2019-11-14 03:46:40 +00:00
scripts/format-*.sh \
2019-06-18 16:15:30 +00:00
src/xrt \
\( -name "*.c" \
-o -name "*.cpp" \
-o -name "*.h" \
-o -name "*.hpp" \
2019-06-18 16:15:30 +00:00
-o -name "*.sh" \
-o -name "*.md" \
2023-02-08 23:36:19 +00:00
-o -name "*.comp" \
-o -name "*.py" \
-o -name "*.java" \
-o -name "*.kt" \
-o -name "*.gradle" \
2019-06-18 16:15:30 +00:00
-o -name "CMakeLists.txt" \) \
-exec codespell \
2023-02-08 23:36:19 +00:00
"--exclude-file=${SCRIPTDIR}/monado-codespell.exclude" \
"--ignore-regex=${IGNORE_REGEX}" \
2019-06-18 16:15:30 +00:00
--ignore-words-list="${IGNORE_WORDS_LIST}" \
-w \
"$@" \
\{\} +
)