Skip to content

Commit 560e64c

Browse files
committed
sty: Apply shellcheck diff
git grep -l '^#\( *shellcheck \|!\(/bin/\|/usr/bin/env \)\(sh\|bash\|dash\|ksh\)\)' \ | xargs shellcheck -f diff | git apply
1 parent b33f61a commit 560e64c

14 files changed

+74
-74
lines changed

.circleci/test_pytest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py38" /usr/bin/run_pytests.sh
3+
docker run --rm=false -t -v "$WORKDIR":/work -v "$HOME"/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py38" /usr/bin/run_pytests.sh

docker/files/run_builddocs.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -u
55

66
WORKDIR=${WORK:-/work}
77

8-
mkdir -p ${WORKDIR}/docs
9-
make html 2>&1 | tee ${WORKDIR}/builddocs.log
10-
cp -r /src/nipype/doc/_build/html/* ${WORKDIR}/docs/
11-
cat ${WORKDIR}/builddocs.log && if grep -q "ERROR" ${WORKDIR}/builddocs.log; then false; else true; fi
8+
mkdir -p "${WORKDIR}"/docs
9+
make html 2>&1 | tee "${WORKDIR}"/builddocs.log
10+
cp -r /src/nipype/doc/_build/html/* "${WORKDIR}"/docs/
11+
cat "${WORKDIR}"/builddocs.log && if grep -q "ERROR" "${WORKDIR}"/builddocs.log; then false; else true; fi

docker/files/run_examples.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ arr=$@
88
tmp_var=$( IFS=$' '; echo "${arr[*]}" )
99
example_id=${tmp_var//[^A-Za-z0-9_-]/_}
1010

11-
mkdir -p ${HOME}/.nipype ${WORKDIR}/logs/example_${example_id} ${WORKDIR}/tests ${WORKDIR}/crashfiles
12-
echo "[logging]" > ${HOME}/.nipype/nipype.cfg
13-
echo "workflow_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
14-
echo "interface_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
15-
echo "utils_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
16-
echo "log_to_file = true" >> ${HOME}/.nipype/nipype.cfg
17-
echo "log_directory = ${WORKDIR}/logs/example_${example_id}" >> ${HOME}/.nipype/nipype.cfg
11+
mkdir -p "${HOME}"/.nipype "${WORKDIR}"/logs/example_"${example_id}" "${WORKDIR}"/tests "${WORKDIR}"/crashfiles
12+
echo "[logging]" > "${HOME}"/.nipype/nipype.cfg
13+
echo "workflow_level = DEBUG" >> "${HOME}"/.nipype/nipype.cfg
14+
echo "interface_level = DEBUG" >> "${HOME}"/.nipype/nipype.cfg
15+
echo "utils_level = DEBUG" >> "${HOME}"/.nipype/nipype.cfg
16+
echo "log_to_file = true" >> "${HOME}"/.nipype/nipype.cfg
17+
echo "log_directory = ${WORKDIR}/logs/example_${example_id}" >> "${HOME}"/.nipype/nipype.cfg
1818

19-
echo '[execution]' >> ${HOME}/.nipype/nipype.cfg
20-
echo 'crashfile_format = txt' >> ${HOME}/.nipype/nipype.cfg
19+
echo '[execution]' >> "${HOME}"/.nipype/nipype.cfg
20+
echo 'crashfile_format = txt' >> "${HOME}"/.nipype/nipype.cfg
2121

2222
if [[ "${NIPYPE_RESOURCE_MONITOR:-0}" == "1" ]]; then
23-
echo '[monitoring]' >> ${HOME}/.nipype/nipype.cfg
24-
echo 'enabled = true' >> ${HOME}/.nipype/nipype.cfg
25-
echo 'sample_frequency = 3' >> ${HOME}/.nipype/nipype.cfg
23+
echo '[monitoring]' >> "${HOME}"/.nipype/nipype.cfg
24+
echo 'enabled = true' >> "${HOME}"/.nipype/nipype.cfg
25+
echo 'sample_frequency = 3' >> "${HOME}"/.nipype/nipype.cfg
2626
fi
2727

2828
# Set up coverage
@@ -35,9 +35,9 @@ coverage run /src/nipype/tools/run_examples.py $@
3535
exit_code=$?
3636

3737
if [[ "${NIPYPE_RESOURCE_MONITOR:-0}" == "1" ]]; then
38-
cp resource_monitor.json 2>/dev/null ${WORKDIR}/logs/example_${example_id}/ || :
38+
cp resource_monitor.json 2>/dev/null "${WORKDIR}"/logs/example_"${example_id}"/ || :
3939
fi
4040
# Collect crashfiles and generate xml report
41-
coverage xml -o ${WORKDIR}/tests/smoketest_${example_id}.xml
42-
find /work -maxdepth 1 -name "crash-*" -exec mv {} ${WORKDIR}/crashfiles/ \;
41+
coverage xml -o "${WORKDIR}"/tests/smoketest_"${example_id}".xml
42+
find /work -maxdepth 1 -name "crash-*" -exec mv {} "${WORKDIR}"/crashfiles/ \;
4343
exit $exit_code

docker/files/run_pytests.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,32 @@ WORKDIR=${WORK:-/work}
99
PYTHON_VERSION=$( python -c "import sys; print('{}{}'.format(sys.version_info[0], sys.version_info[1]))" )
1010

1111
# Create necessary directories
12-
mkdir -p ${WORKDIR}/tests ${WORKDIR}/crashfiles ${WORKDIR}/logs/py${PYTHON_VERSION}
12+
mkdir -p "${WORKDIR}"/tests "${WORKDIR}"/crashfiles "${WORKDIR}"/logs/py"${PYTHON_VERSION}"
1313

1414
# Create a nipype config file
15-
mkdir -p ${HOME}/.nipype
16-
echo '[logging]' > ${HOME}/.nipype/nipype.cfg
17-
echo 'log_to_file = true' >> ${HOME}/.nipype/nipype.cfg
18-
echo "log_directory = ${WORKDIR}/logs/py${PYTHON_VERSION}" >> ${HOME}/.nipype/nipype.cfg
15+
mkdir -p "${HOME}"/.nipype
16+
echo '[logging]' > "${HOME}"/.nipype/nipype.cfg
17+
echo 'log_to_file = true' >> "${HOME}"/.nipype/nipype.cfg
18+
echo "log_directory = ${WORKDIR}/logs/py${PYTHON_VERSION}" >> "${HOME}"/.nipype/nipype.cfg
1919

20-
echo '[execution]' >> ${HOME}/.nipype/nipype.cfg
21-
echo 'crashfile_format = txt' >> ${HOME}/.nipype/nipype.cfg
20+
echo '[execution]' >> "${HOME}"/.nipype/nipype.cfg
21+
echo 'crashfile_format = txt' >> "${HOME}"/.nipype/nipype.cfg
2222

2323
if [[ "${NIPYPE_RESOURCE_MONITOR:-0}" == "1" ]]; then
24-
echo 'resource_monitor = true' >> ${HOME}/.nipype/nipype.cfg
24+
echo 'resource_monitor = true' >> "${HOME}"/.nipype/nipype.cfg
2525
fi
2626

2727
# Run tests using pytest
2828
export COVERAGE_FILE=${WORKDIR}/tests/.coverage.py${PYTHON_VERSION}
29-
py.test -v --junitxml=${WORKDIR}/tests/pytests_py${PYTHON_VERSION}.xml \
29+
py.test -v --junitxml="${WORKDIR}"/tests/pytests_py"${PYTHON_VERSION}".xml \
3030
--cov nipype --cov-config /src/nipype/.coveragerc \
31-
--cov-report xml:${WORKDIR}/tests/coverage_py${PYTHON_VERSION}.xml \
31+
--cov-report xml:"${WORKDIR}"/tests/coverage_py"${PYTHON_VERSION}".xml \
3232
-n auto \
33-
-c ${TESTPATH}/pytest.ini ${TESTPATH}
33+
-c "${TESTPATH}"/pytest.ini "${TESTPATH}"
3434
exit_code=$?
3535

3636
# Collect crashfiles
37-
find ${WORKDIR} -maxdepth 1 -name "crash-*" -exec mv {} ${WORKDIR}/crashfiles/ \;
37+
find "${WORKDIR}" -maxdepth 1 -name "crash-*" -exec mv {} "${WORKDIR}"/crashfiles/ \;
3838

3939
echo "Unit tests finished with exit code ${exit_code}"
4040
exit ${exit_code}

docker/generate_dockerfiles.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
set -e
66

7-
USAGE="usage: $(basename $0) [-h] [-b] [-m]"
7+
USAGE="usage: $(basename "$0") [-h] [-b] [-m]"
88

99
function Help {
1010
cat <<USAGE
1111
Generate base and/or main Dockerfiles for Nipype.
1212
1313
Usage:
1414
15-
$(basename $0) [-h] [-b] [-m]
15+
$(basename "$0") [-h] [-b] [-m]
1616
1717
Options:
1818

docker/prune_dockerfile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
if [ -z "$1" ]; then
4-
echo "Usage: $(basename $0) <input_filepath>"
4+
echo "Usage: $(basename "$0") <input_filepath>"
55
exit 1
66
fi
77

tools/ci/check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ source tools/ci/env.sh
88
set -eu
99

1010
# Required variables
11-
echo CHECK_TYPE = $CHECK_TYPE
11+
echo CHECK_TYPE = "$CHECK_TYPE"
1212

1313
set -x
1414

tools/ci/create_venv.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ source tools/ci/env.sh
77
set -eu
88

99
# Required variables
10-
echo SETUP_REQUIRES = $SETUP_REQUIRES
10+
echo SETUP_REQUIRES = "$SETUP_REQUIRES"
1111

1212
set -x
1313

1414
python -m pip install --upgrade pip virtualenv
1515
virtualenv --python=python virtenv
1616
source tools/ci/activate.sh
1717
python --version
18-
python -m pip install -U $SETUP_REQUIRES
18+
python -m pip install -U "$SETUP_REQUIRES"
1919
which python
2020
which pip
2121

tools/ci/install.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ source tools/ci/env.sh
88
set -eu
99

1010
# Required variables
11-
echo INSTALL_TYPE = $INSTALL_TYPE
12-
echo CHECK_TYPE = $CHECK_TYPE
13-
echo NIPYPE_EXTRAS = $NIPYPE_EXTRAS
14-
echo EXTRA_PIP_FLAGS = $EXTRA_PIP_FLAGS
11+
echo INSTALL_TYPE = "$INSTALL_TYPE"
12+
echo CHECK_TYPE = "$CHECK_TYPE"
13+
echo NIPYPE_EXTRAS = "$NIPYPE_EXTRAS"
14+
echo EXTRA_PIP_FLAGS = "$EXTRA_PIP_FLAGS"
1515

1616
set -x
1717

@@ -22,7 +22,7 @@ fi
2222
if [ "$INSTALL_TYPE" == "setup" ]; then
2323
python setup.py install
2424
else
25-
pip install $EXTRA_PIP_FLAGS $ARCHIVE
25+
pip install "$EXTRA_PIP_FLAGS" "$ARCHIVE"
2626
fi
2727

2828
# Basic import check
@@ -32,7 +32,7 @@ if [ "$CHECK_TYPE" == "skiptests" ]; then
3232
exit 0
3333
fi
3434

35-
pip install $EXTRA_PIP_FLAGS "nipype[$NIPYPE_EXTRAS]"
35+
pip install "$EXTRA_PIP_FLAGS" "nipype[$NIPYPE_EXTRAS]"
3636

3737
set +eux
3838

tools/ci/install_dependencies.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ source tools/ci/env.sh
88
set -eu
99

1010
# Required variables
11-
echo EXTRA_PIP_FLAGS = $EXTRA_PIP_FLAGS
12-
echo DEPENDS = $DEPENDS
11+
echo EXTRA_PIP_FLAGS = "$EXTRA_PIP_FLAGS"
12+
echo DEPENDS = "$DEPENDS"
1313

1414
set -x
1515

@@ -18,7 +18,7 @@ if [ -n "$EXTRA_PIP_FLAGS" ]; then
1818
fi
1919

2020
if [ -n "$DEPENDS" ]; then
21-
pip install ${EXTRA_PIP_FLAGS} --prefer-binary ${!DEPENDS}
21+
pip install "${EXTRA_PIP_FLAGS}" --prefer-binary "${!DEPENDS}"
2222
fi
2323

2424
set +eux

0 commit comments

Comments
 (0)