Skip to content

Commit 0483c48

Browse files
authored
Merge pull request #16 from wangfenjin/query-error
Update error msg
2 parents df3aeca + 9f8ffc2 commit 0483c48

File tree

10 files changed

+30584
-23148
lines changed

10 files changed

+30584
-23148
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.EXPORT_ALL_VARIABLES:
2+
3+
# In order to use buildtime_bindgen
4+
# you need to build duckdb locally and export the envs
5+
LD_LIBRARY_PATH = /Users/wangfenjin/duckdb:$LD_LIBRARY_PATH
6+
DUCKDB_LIB_DIR = /Users/wangfenjin/duckdb
7+
DUCKDB_INCLUDE_DIR = /Users/wangfenjin/duckdb
8+
9+
all:
10+
cargo test --features buildtime_bindgen -- --nocapture
11+
cargo clippy --all-targets --workspace --features buildtime_bindgen -- -D warnings -A clippy::redundant-closure

add_rustfmt_hook.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
3+
# https://gist.github.com/folex/9496c457bcbbef36255a533389da740e
4+
5+
# check that rustfmt installed, or else this hook doesn't make much sense
6+
command -v rustfmt >/dev/null 2>&1 || { echo >&2 "Rustfmt is required but it's not installed. Aborting."; exit 1; }
7+
8+
# write a whole script to pre-commit hook
9+
# NOTE: it will overwrite pre-commit file!
10+
cat > .git/hooks/pre-commit <<'EOF'
11+
#!/bin/bash -e
12+
declare -a rust_files=()
13+
files=$(git diff-index --name-only HEAD)
14+
echo 'Formatting source files'
15+
for file in $files; do
16+
if [ ! -f "${file}" ]; then
17+
continue
18+
fi
19+
if [[ "${file}" == *.rs ]]; then
20+
rust_files+=("${file}")
21+
fi
22+
done
23+
if [ ${#rust_files[@]} -ne 0 ]; then
24+
command -v rustfmt >/dev/null 2>&1 || { echo >&2 "Rustfmt is required but it's not installed. Aborting."; exit 1; }
25+
$(command -v rustfmt) ${rust_files[@]} &
26+
fi
27+
wait
28+
if [ ${#rust_files[@]} -ne 0 ]; then
29+
git add ${rust_files[@]}
30+
echo "Formatting done, changed files: ${rust_files[@]}"
31+
else
32+
echo "No changes, formatting skipped"
33+
fi
34+
EOF
35+
36+
chmod +x .git/hooks/pre-commit
37+
38+
echo "Hooks updated"

0 commit comments

Comments
 (0)