Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: try to catch last undefined safety issues #2027

Merged
merged 6 commits into from
Sep 5, 2023
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 bootstrap_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

set -e

PROJECT_NAME=$1
PROJECT_NAME=${1:-}
COMMIT_HASH=$(git rev-parse HEAD)
ONLY_TARGET=${ONLY_TARGET:-}

Expand Down
2 changes: 1 addition & 1 deletion build-system/scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ for STAGE in $STAGES; do
# Build our dockerfile, add timing information

# Check if there is a commit tag
if [[ -n "$COMMIT_TAG" ]]; then
if [[ -n "${COMMIT_TAG:-}" ]]; then

# Check if it's a repo-specific tag
if [[ "$COMMIT_TAG" == *"/"* ]]; then
Expand Down
2 changes: 1 addition & 1 deletion build-system/scripts/deploy_ecr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ docker tag $IMAGE_COMMIT_URI $IMAGE_DEPLOY_COMMIT_URI
docker push $IMAGE_DEPLOY_COMMIT_URI

# Tag image with full version if we have one. Allows deployment of precise image version if rollback needed.
if [ -n "$COMMIT_TAG" ]; then
if [ -n "${COMMIT_TAG:-}" ]; then
tag_remote_image $REPOSITORY $COMMIT_HASH $PROJECT-$COMMIT_TAG $ECR_DEPLOY_REGION
fi

Expand Down
4 changes: 2 additions & 2 deletions build-system/scripts/deploy_npm
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
set -eu

readonly REPOSITORY=$1
readonly STANDALONE=$2
readonly STANDALONE=${2:-}

# Only publish tagged commits to npm.
[ -n "$COMMIT_TAG" ] || { echo "Will only publish tagged commits to npm. Skipping." && exit 0; }
[ -n "${COMMIT_TAG:-}" ] || { echo "Will only publish tagged commits to npm. Skipping." && exit 0; }

extract_repo $REPOSITORY /usr/src project

Expand Down
2 changes: 1 addition & 1 deletion build-system/scripts/erase_image_tags
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -eu
REPOSITORY=$1
TILL_COMMIT_HASH=$2

if [ -n "$3" ]; then
if [ -n "${3:-}" ]; then
TAG_POSTFIX=-$3
fi

Expand Down
2 changes: 1 addition & 1 deletion build-system/scripts/force_deploy_build
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [[ $FORCE_BUILD == 'true' ]]; then
fi

# Check if there's a commit TAG
if [[ -n "$COMMIT_TAG" ]]; then
if [[ -n "${COMMIT_TAG:-}" ]]; then
# Check if it's a repo-specific tag
if [[ "$COMMIT_TAG" == *"/"* ]]; then
REPO_NAME="${COMMIT_TAG%%/*}"
Expand Down
2 changes: 1 addition & 1 deletion build-system/scripts/setup_env
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ echo "JOB_NAME=$JOB_NAME"
echo "GIT_REPOSITORY_URL=$GIT_REPOSITORY_URL"
echo "BRANCH=$BRANCH"

if [ -n "$COMMIT_TAG" ]; then
if [ -n "${COMMIT_TAG:-}" ]; then
# We're tagged e.g. v2.1.123 or v2.1.123-testnet.0.
# First we sanity check that the tag matches the VERSION file.
echo "Extracting commit tag version..."
Expand Down
4 changes: 2 additions & 2 deletions circuits/cpp/format.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
set -eu

if [ "$1" == "staged" ]; then
if [ "${1:-}" == "staged" ]; then
echo Formatting staged files...
for FILE in $(git diff-index --diff-filter=d --relative --cached --name-only HEAD | grep -e '\.\(cpp\|hpp\|tcc\)$'); do
clang-format -i $FILE
sed -i.bak 's/\r$//' $FILE && rm ${FILE}.bak
git add $FILE
done
elif [ -n "$1" ]; then
elif [ -n "${1:-}" ]; then
for FILE in $(git diff-index --relative --name-only $1 | grep -e '\.\(cpp\|hpp\|tcc\)$'); do
clang-format -i $FILE
sed -i.bak 's/\r$//' $FILE && rm ${FILE}.bak
Expand Down
4 changes: 2 additions & 2 deletions circuits/cpp/scripts/run_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TESTS=$1
BUILD_DIR="build-coverage"

# If the clean file is set, wipe all existing coverage data
if [ -n "$CLEAN" ]; then
if [ -n "${CLEAN:-}" ]; then
echo "The CLEAN environment variable is set. Clearing existing coverage data."
rm -rf ./$BUILD_DIR || true
fi
Expand All @@ -47,7 +47,7 @@ elif [ -f "$TESTS" ]; then
fi

# if just the CLEAR_COV env var is set then we will clear existing coveage report information
if [ -n "$CLEAR_COV" ]; then
if [ -n "${CLEAR_COV:-}" ]; then
echo "The CLEAR_COV environment variable is set. Clearing existing coverage data."
rm ./$BUILD_DIR/lcov.info || true
rm ./$BUILD_DIR/merged_profdata/default.profdata || true
Expand Down
2 changes: 1 addition & 1 deletion circuits/cpp/scripts/run_tests_local
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ARCH=$1
# 3. or a file containing a list of test
TESTS=$2
# GTEST_FILTER: optional pattern like "*native*" to filter gtests
GTEST_FILTER=$3
GTEST_FILTER=${3:-}

# Shift away the args
shift
Expand Down