forked from quantumlib/Cirq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmisc
executable file
·25 lines (21 loc) · 886 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
#!/usr/bin/env bash
################################################################################
# Runs misc custom checks on repistory.
#
# Usage:
# check/misc
################################################################################
# Get the working directory to the repo root.
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd "$(git rev-parse --show-toplevel)"
# Check for non-contrib references to contrib.
results=$(grep -Rl "\bcirq\.contrib\b" cirq | 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[contrib]'.\033[0m"
exit 1
fi
echo -e "\033[32mNo issues\033[0m."