From 968b59aadde0aa2b51e3059d392a4dfef4917b06 Mon Sep 17 00:00:00 2001 From: mlevesquedion Date: Wed, 31 Jan 2024 15:09:23 -0800 Subject: [PATCH] Fix SC2155 issues (#1975) I forgot to include this in https://github.com/openxla/stablehlo/pull/1971 (made the change locally and forgot to push before merging). I originally suppressed these lints because I misunderstood how `set -o errexit` interacts with `readonly`. I thought a failure would still bring down the whole script, but that's not the case. So instead of suppressing the lint, I fixed the issue. --- build_tools/github_actions/lint_buildifier.sh | 4 ++-- build_tools/github_actions/lint_markdown.sh | 4 ++-- build_tools/github_actions/lint_shellcheck.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build_tools/github_actions/lint_buildifier.sh b/build_tools/github_actions/lint_buildifier.sh index cadcfa27858..63d8f1f9783 100755 --- a/build_tools/github_actions/lint_buildifier.sh +++ b/build_tools/github_actions/lint_buildifier.sh @@ -23,8 +23,8 @@ if ! command -v buildifier &> /dev/null; then exit 1 fi -# shellcheck disable=SC2155 -readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +readonly SCRIPT_DIR readonly STABLEHLO_ROOT_DIR="${SCRIPT_DIR}/../.." cd "$STABLEHLO_ROOT_DIR" diff --git a/build_tools/github_actions/lint_markdown.sh b/build_tools/github_actions/lint_markdown.sh index a13fae289d5..995565f67e0 100755 --- a/build_tools/github_actions/lint_markdown.sh +++ b/build_tools/github_actions/lint_markdown.sh @@ -27,8 +27,8 @@ if [[ $# -gt 2 ]] ; then exit 1 fi -# shellcheck disable=SC2155 -readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +readonly SCRIPT_DIR readonly STABLEHLO_ROOT_DIR="${SCRIPT_DIR}/../.." # These must be relative to the repo root because that's the context diff --git a/build_tools/github_actions/lint_shellcheck.sh b/build_tools/github_actions/lint_shellcheck.sh index 9ba54c9998d..b71108338e8 100755 --- a/build_tools/github_actions/lint_shellcheck.sh +++ b/build_tools/github_actions/lint_shellcheck.sh @@ -25,8 +25,8 @@ if ! command -v shellcheck &> /dev/null; then exit 1 fi -# shellcheck disable=SC2155 -readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +readonly SCRIPT_DIR readonly STABLEHLO_ROOT_DIR="${SCRIPT_DIR}/../.." cd "$STABLEHLO_ROOT_DIR"