Skip to content

Fix all issues from shellcheck --severity=warning #2354

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

Merged
merged 10 commits into from
Apr 16, 2024
Merged
19 changes: 19 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Shellcheck

on:
push:
branches-ignore:
- 'release/*'
pull_request:

jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install shellcheck
run: sudo apt update && sudo apt install --assume-yes shellcheck

- name: Run shellcheck
run: find . -name \*.sh | xargs shellcheck --severity=warning
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ PROTO_VERSION=v1.3.2

# SRC_DIR is from protoc perspective. ie its the destination for our checkouts/clones
SRC_DIR=opentelemetry/exporter/prometheus_remote_write/gen/
DST_DIR=../src/opentelemetry/exporter/prometheus_remote_write/gen/

#TODO:
# Check that black & protoc are installed properly
Expand Down
4 changes: 2 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ set -ev
# Get the latest versions of packaging tools
python3 -m pip install --upgrade pip build setuptools wheel

BASEDIR=$(dirname $(readlink -f $(dirname $0)))
BASEDIR=$(dirname "$(readlink -f "$(dirname $0)")")
DISTDIR=dist

(
cd $BASEDIR
mkdir -p $DISTDIR
rm -rf $DISTDIR/*
rm -rf ${DISTDIR:?}/*

for d in exporter/*/ opentelemetry-instrumentation/ opentelemetry-contrib-instrumentations/ opentelemetry-distro/ instrumentation/*/ propagator/*/ resource/*/ sdk-extension/*/ util/*/ ; do
(
Expand Down
8 changes: 4 additions & 4 deletions scripts/build_a_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set -ev

if [ -z $GITHUB_REF ]; then
echo 'Failed to run script, missing workflow env variable GITHUB_REF.'
exit -1
exit 1
fi

pkg_name_and_version=${GITHUB_REF#refs/tags/*}
Expand All @@ -40,13 +40,13 @@ cd $basedir

distdir=${basedir}/dist
mkdir -p $distdir
rm -rf $distdir/*
rm -rf ${distdir:?}/*

pyproject_toml_file_path=$(ls **/$pkg_name/pyproject.toml)

if [ -z $pyproject_toml_file_path ]; then
echo "Error! pyproject.toml not found for $pkg_name, can't build."
exit -1
exit 1
fi

directory_with_package=$(dirname $pyproject_toml_file_path)
Expand All @@ -61,7 +61,7 @@ pkg_tar_gz_file=${pkg_name}-${pkg_version}.tar.gz

if ! [ -f $pkg_tar_gz_file ]; then
echo 'Error! Tag version does not match version built using latest package files.'
exit -1
exit 1
fi

# Build a wheel for the source distribution
Expand Down
3 changes: 0 additions & 3 deletions scripts/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ function cov {
${1}
}

PYTHON_VERSION=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')
PYTHON_VERSION_INFO=(${PYTHON_VERSION//./ })

coverage erase

cov instrumentation/opentelemetry-instrumentation-flask
Expand Down