Skip to content

Commit 3fc4f33

Browse files
committed
separate scripts/check.sh file for typechecking/linting
1 parent bafd8b1 commit 3fc4f33

File tree

2 files changed

+53
-6
lines changed

2 files changed

+53
-6
lines changed

scripts/check-licensing.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

scripts/check.sh

100644100755
Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,56 @@
11
#!/usr/bin/env sh
22

3-
npx tsc --noEmit --skipLibCheck
3+
while [ $# -gt 0 ]; do
4+
case "$1" in
5+
"tc")
6+
check_types="$check_types tc"
7+
;;
8+
"lint")
9+
check_types="$check_types lint"
10+
;;
11+
"licensing")
12+
check_types="$check_types licensing"
13+
;;
14+
*)
15+
if [ "$1" != "--help" ] && [ "$1" != "-help" ] && [ "$1" != "-h" ]; then
16+
echo "Invalid flag $1"
17+
echo
18+
fi
19+
echo "Usage:"
20+
echo
21+
echo "$0 [tc] [lint] [licensing]"
22+
echo
23+
echo "* tc: runs the type-checker"
24+
echo "* lint: checks for linting errors"
25+
echo "* licensing: checks for missing licensing headers"
26+
echo
27+
echo "Defaults to running all checks if no specific checks are specified."
28+
exit
29+
esac
30+
shift
31+
done
432

5-
npm run lint -- --no-warn-ignored
33+
if [ -z "$check_types" ]; then
34+
check_types="tc lint licensing"
35+
fi
36+
37+
for check_type in $check_types; do
38+
case $check_type in
39+
"tc")
40+
echo "Running type-checker..."
41+
npx tsc --noEmit --skipLibCheck || exit 10
42+
;;
43+
"lint")
44+
echo "Running linter..."
45+
npm run lint -- --no-warn-ignored || exit 20
46+
;;
47+
"licensing")
48+
echo "Checking for missing licensing headers..."
49+
find tests/ src/ -type f -exec grep -L "^// Copyright DataStax, Inc." {} + || exit 30
50+
;;
51+
"*")
52+
echo "Invalid check type '$check_type'"
53+
exit 1
54+
;;
55+
esac
56+
done

0 commit comments

Comments
 (0)