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

This commit is contained in:
John Bley
2024-04-16 12:36:37 -04:00
committed by GitHub
parent e84bfff6cf
commit 8322ee790e
5 changed files with 25 additions and 10 deletions

19
.github/workflows/shellcheck.yml vendored Normal file
View File

@ -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

View File

@ -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 is from protoc perspective. ie its the destination for our checkouts/clones
SRC_DIR=opentelemetry/exporter/prometheus_remote_write/gen/ SRC_DIR=opentelemetry/exporter/prometheus_remote_write/gen/
DST_DIR=../src/opentelemetry/exporter/prometheus_remote_write/gen/
#TODO: #TODO:
# Check that black & protoc are installed properly # Check that black & protoc are installed properly

View File

@ -8,13 +8,13 @@ set -ev
# Get the latest versions of packaging tools # Get the latest versions of packaging tools
python3 -m pip install --upgrade pip build setuptools wheel python3 -m pip install --upgrade pip build setuptools wheel
BASEDIR=$(dirname $(readlink -f $(dirname $0))) BASEDIR=$(dirname "$(readlink -f "$(dirname $0)")")
DISTDIR=dist DISTDIR=dist
( (
cd $BASEDIR cd $BASEDIR
mkdir -p $DISTDIR 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 for d in exporter/*/ opentelemetry-instrumentation/ opentelemetry-contrib-instrumentations/ opentelemetry-distro/ instrumentation/*/ propagator/*/ resource/*/ sdk-extension/*/ util/*/ ; do
( (

View File

@ -22,7 +22,7 @@ set -ev
if [ -z $GITHUB_REF ]; then if [ -z $GITHUB_REF ]; then
echo 'Failed to run script, missing workflow env variable GITHUB_REF.' echo 'Failed to run script, missing workflow env variable GITHUB_REF.'
exit -1 exit 1
fi fi
pkg_name_and_version=${GITHUB_REF#refs/tags/*} pkg_name_and_version=${GITHUB_REF#refs/tags/*}
@ -40,13 +40,13 @@ cd $basedir
distdir=${basedir}/dist distdir=${basedir}/dist
mkdir -p $distdir mkdir -p $distdir
rm -rf $distdir/* rm -rf ${distdir:?}/*
pyproject_toml_file_path=$(ls **/$pkg_name/pyproject.toml) pyproject_toml_file_path=$(ls **/$pkg_name/pyproject.toml)
if [ -z $pyproject_toml_file_path ]; then if [ -z $pyproject_toml_file_path ]; then
echo "Error! pyproject.toml not found for $pkg_name, can't build." echo "Error! pyproject.toml not found for $pkg_name, can't build."
exit -1 exit 1
fi fi
directory_with_package=$(dirname $pyproject_toml_file_path) directory_with_package=$(dirname $pyproject_toml_file_path)
@ -61,7 +61,7 @@ pkg_tar_gz_file=${pkg_name}-${pkg_version}.tar.gz
if ! [ -f $pkg_tar_gz_file ]; then if ! [ -f $pkg_tar_gz_file ]; then
echo 'Error! Tag version does not match version built using latest package files.' echo 'Error! Tag version does not match version built using latest package files.'
exit -1 exit 1
fi fi
# Build a wheel for the source distribution # Build a wheel for the source distribution

View File

@ -11,9 +11,6 @@ function cov {
${1} ${1}
} }
PYTHON_VERSION=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')
PYTHON_VERSION_INFO=(${PYTHON_VERSION//./ })
coverage erase coverage erase
cov instrumentation/opentelemetry-instrumentation-flask cov instrumentation/opentelemetry-instrumentation-flask