Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

format test codes and ensure travis fails on unformatted files #36

Merged
merged 1 commit into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ pegasus-client.iml
log.txt
rolling_log/
.vscode/

google-java-format-*
7 changes: 6 additions & 1 deletion scripts/format-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ SRC_FILES=(src/main/java/com/xiaomi/infra/pegasus/client/*.java
src/main/java/com/xiaomi/infra/pegasus/rpc/*.java
src/main/java/com/xiaomi/infra/pegasus/rpc/async/*.java
src/main/java/com/xiaomi/infra/pegasus/operator/*.java
src/main/java/com/xiaomi/infra/pegasus/tools/*.java)
src/main/java/com/xiaomi/infra/pegasus/tools/*.java
src/test/java/com/xiaomi/infra/pegasus/client/*.java
src/test/java/com/xiaomi/infra/pegasus/metrics/*.java
src/test/java/com/xiaomi/infra/pegasus/rpc/async/*.java
src/test/java/com/xiaomi/infra/pegasus/tools/*.java
)

if [ ! -f "${PROJECT_DIR}"/google-java-format-1.7-all-deps.jar ]; then
wget https://github.com/google/google-java-format/releases/download/google-java-format-1.7/google-java-format-1.7-all-deps.jar
Expand Down
9 changes: 8 additions & 1 deletion scripts/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ cd "${PROJECT_DIR}" || exit -1
# lint all scripts, abort if there's any warning.
function shellcheck_must_pass()
{
echo "$1"
if [[ $(shellcheck "$1") ]]; then
echo "shellcheck $1 failed"
shellcheck "$1"
Expand All @@ -19,6 +18,14 @@ function shellcheck_must_pass()
shellcheck_must_pass ./scripts/format-all.sh
shellcheck_must_pass ./scripts/travis.sh

# ensure source files are well formatted
./scripts/format-all.sh
if [[ $(git status -s) ]]; then
git status -s
echo "please format the above files before commit"
exit 1
fi

# start pegasus onebox environment
wget https://github.com/XiaoMi/pegasus/releases/download/v1.11.2/pegasus-tools-1.11.2-a186d38-ubuntu-18.04-release.tar.gz
tar xvf pegasus-tools-1.11.2-a186d38-ubuntu-18.04-release.tar.gz
Expand Down
Loading