-
Notifications
You must be signed in to change notification settings - Fork 1k
/
misc
executable file
·26 lines (22 loc) · 967 Bytes
/
misc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
################################################################################
# Runs misc custom checks on repistory.
#
# Usage:
# check/misc
################################################################################
# Get the working directory to the repo root.
thisdir="$(dirname "${BASH_SOURCE[0]}")" || exit $?
topdir="$(git -C "${thisdir}" rev-parse --show-toplevel)" || exit $?
cd "${topdir}" || exit $?
# Check for non-contrib references to contrib.
results=$(grep -Rl "\bcirq\.contrib\b" cirq-core | grep -v "cirq/contrib" | grep -v "__")
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo -e "\033[31m'cirq.contrib' mentioned in non-contrib files:\033[0m"
echo "${results}"
echo
echo -e "\033[31mSource files outside cirq.contrib must not reference cirq.contrib, as this can cause errors for users who 'pip install cirq' instead of 'pip install cirq-core[contrib]'.\033[0m"
exit 1
fi
echo -e "\033[32mNo issues\033[0m."