From 5683f9a86edeee1872eadc688da76c99a5501b81 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Thu, 26 May 2022 18:26:08 -0700 Subject: [PATCH] Simplify cd to the executing script directory Drop redundant `cd "$(pwd)"` --- check/all | 2 +- check/asv_run | 2 +- check/build-changed-protos | 2 +- check/doctest | 2 +- check/format-incremental | 2 +- check/mypy | 2 +- check/nbformat | 2 +- check/npm | 2 +- check/npx | 2 +- check/pylint | 2 +- check/pylint-changed-files | 2 +- check/pytest | 2 +- check/pytest-changed-files | 2 +- check/ts-build | 2 +- check/ts-coverage | 2 +- check/ts-lint | 2 +- check/ts-lint-and-format | 2 +- check/ts-test | 2 +- check/ts-test-e2e | 2 +- dev_tools/build-protos.sh | 2 +- dev_tools/pr_monitor.sh | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/check/all b/check/all index 450aa2624f1..ed6741dc1e1 100755 --- a/check/all +++ b/check/all @@ -31,7 +31,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" # Parse arguments. diff --git a/check/asv_run b/check/asv_run index 1bfbe218abf..5c3d7e1e860 100755 --- a/check/asv_run +++ b/check/asv_run @@ -8,7 +8,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" export ASV_PYTHONPATH="$(git rev-parse --show-toplevel)/examples" diff --git a/check/build-changed-protos b/check/build-changed-protos index 0526c19a189..260752078e7 100755 --- a/check/build-changed-protos +++ b/check/build-changed-protos @@ -26,7 +26,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" # Figure out which revision to compare against. diff --git a/check/doctest b/check/doctest index 8340ccd76b5..d839a23b2ce 100755 --- a/check/doctest +++ b/check/doctest @@ -14,7 +14,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" source dev_tools/pypath diff --git a/check/format-incremental b/check/format-incremental index e16f47927f6..947b7d0254f 100755 --- a/check/format-incremental +++ b/check/format-incremental @@ -32,7 +32,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" diff --git a/check/mypy b/check/mypy index 25f4f9015fb..3818c0378ac 100755 --- a/check/mypy +++ b/check/mypy @@ -8,7 +8,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" config_file='mypy.ini' diff --git a/check/nbformat b/check/nbformat index 5c9893d4f2a..b4aab40a817 100755 --- a/check/nbformat +++ b/check/nbformat @@ -25,7 +25,7 @@ for arg in "$@"; do done # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" pip show tensorflow-docs > /dev/null || exit 1 diff --git a/check/npm b/check/npm index 0c7fa392c87..a685af4fc52 100755 --- a/check/npm +++ b/check/npm @@ -23,7 +23,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" npm --prefix 'cirq-web/cirq_ts' "$@" diff --git a/check/npx b/check/npx index 10bbda894fe..bc2bf65c95b 100755 --- a/check/npx +++ b/check/npx @@ -22,7 +22,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" cd 'cirq-web/cirq_ts' diff --git a/check/pylint b/check/pylint index 6970342fcbd..0c869934e56 100755 --- a/check/pylint +++ b/check/pylint @@ -8,7 +8,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" CIRQ_MODULES=$(env PYTHONPATH=. python dev_tools/modules.py list --mode package-path) diff --git a/check/pylint-changed-files b/check/pylint-changed-files index 37803e026d8..c70a087e961 100755 --- a/check/pylint-changed-files +++ b/check/pylint-changed-files @@ -25,7 +25,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" # Figure out which revision to compare against. diff --git a/check/pytest b/check/pytest index 27c9861a4cb..1c247a74e3f 100755 --- a/check/pytest +++ b/check/pytest @@ -14,7 +14,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" PYTEST_ARGS=() diff --git a/check/pytest-changed-files b/check/pytest-changed-files index 9b57b1bf7bd..75e19fa0f44 100755 --- a/check/pytest-changed-files +++ b/check/pytest-changed-files @@ -28,7 +28,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" # Figure out which branch to compare against. diff --git a/check/ts-build b/check/ts-build index 554a852dc09..504342dff4e 100755 --- a/check/ts-build +++ b/check/ts-build @@ -22,7 +22,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" check/npx webpack --mode production "$@" diff --git a/check/ts-coverage b/check/ts-coverage index 88c73cee0d1..191fd583e78 100755 --- a/check/ts-coverage +++ b/check/ts-coverage @@ -22,7 +22,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" check/npm run coverage "$@" diff --git a/check/ts-lint b/check/ts-lint index 9d1215b3bd8..515928cdb10 100755 --- a/check/ts-lint +++ b/check/ts-lint @@ -22,7 +22,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" check/npm run lint "$@" diff --git a/check/ts-lint-and-format b/check/ts-lint-and-format index f3e19f480e4..efc9b7df0c0 100755 --- a/check/ts-lint-and-format +++ b/check/ts-lint-and-format @@ -22,7 +22,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" check/npm run fix "$@" diff --git a/check/ts-test b/check/ts-test index bf25831e5b9..980aed9600f 100755 --- a/check/ts-test +++ b/check/ts-test @@ -24,7 +24,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" check/npm run test "$@" diff --git a/check/ts-test-e2e b/check/ts-test-e2e index 9e2ec6b9b88..a1eb89be363 100755 --- a/check/ts-test-e2e +++ b/check/ts-test-e2e @@ -24,7 +24,7 @@ ################################################################################ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" check/npm run test-e2e "$@" diff --git a/dev_tools/build-protos.sh b/dev_tools/build-protos.sh index aff890d90fd..4b1d3cd3808 100755 --- a/dev_tools/build-protos.sh +++ b/dev_tools/build-protos.sh @@ -25,7 +25,7 @@ set -e trap "{ echo -e '\033[31mFAILED\033[0m'; }" ERR # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)" cd $(pwd)/cirq-google diff --git a/dev_tools/pr_monitor.sh b/dev_tools/pr_monitor.sh index f6ee1f8b006..49f8d4ab737 100755 --- a/dev_tools/pr_monitor.sh +++ b/dev_tools/pr_monitor.sh @@ -48,7 +48,7 @@ # Get the working directory to the repo root. -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$(dirname "${BASH_SOURCE[0]}")" repo_dir=$(git rev-parse --show-toplevel) cd "${repo_dir}"