Add support for pre-commit hook/linting
.pre-commit-config.yaml
-----------------------
o Create initial config for pre-commit hook.
misc/*
o Basic inline cleanups courtesy of the pre-commit hook.
Signed-off-by: Joey Armstrong <jarmstrong@linuxfoundation.org>
Change-Id: I6aa20216ade22b1a7406e8358864fb245842b713
diff --git a/jjb/shell/common/README.md b/jjb/shell/common/README.md
index 07d5e70..82fef33 100644
--- a/jjb/shell/common/README.md
+++ b/jjb/shell/common/README.md
@@ -30,5 +30,3 @@
source common/common.sh
source common/common.sh --tempdir
source common/common.sh --traputils --stacktrace
-
-
diff --git a/jjb/shell/common/common/sh/tempdir.sh b/jjb/shell/common/common/sh/tempdir.sh
index 40d842e..417cb6d 100644
--- a/jjb/shell/common/common/sh/tempdir.sh
+++ b/jjb/shell/common/common/sh/tempdir.sh
@@ -31,13 +31,13 @@
function common_tempdir_mkdir()
{
local var="$1"; shift
-
+
local pkgbase="${0##*/}" # basename
local pkgname="${pkgbase%.*}"
local __junk__
local __junk__="$(mktemp -d -t "${pkgname}.XXXXXXXXXX")"
-
+
__COMMON_TEMP_DIRS__+=("$__junk__")
export TMPDIR="$__junk__"
diff --git a/jjb/shell/common/common/sh/traputils.sh b/jjb/shell/common/common/sh/traputils.sh
index ded5cc7..cf51f8a 100644
--- a/jjb/shell/common/common/sh/traputils.sh
+++ b/jjb/shell/common/common/sh/traputils.sh
@@ -44,18 +44,18 @@
{
local new_trap="$1"; shift
declare -a sigs=($*)
-
+
# local sigs=$*
local sig
for sig in "${sigs[@]}";
do
local stack_name="$(trap_stack_name "$sig")"
local old_trap="$(get_trap "$sig")"
-
+
# eval '__trap_stack_SIGUSR1[${#__trap_stack_SIGUSR1[@]}]=$old_trap'
# __trap_stack_SIGUSR1[${#__trap_stack_SIGUSR1[@]}]=one
# trap two SIGUSR1
-
+
eval "${stack_name}"'[${#'"${stack_name}"'[@]}]=$old_trap'
trap "${new_trap}" "$sig"
done
diff --git a/jjb/shell/common/example.sh b/jjb/shell/common/example.sh
index 0c0e46a..ada12ae 100755
--- a/jjb/shell/common/example.sh
+++ b/jjb/shell/common/example.sh
@@ -54,7 +54,7 @@
# foo: hello - stack_frame[1]
# bar: hello - stack_frame[2]
# tans: early exit for stacktrace
-#
+#
# OFFENDER: ./example.sh:1
# ERROR: 'exit 1' exited with status 1
# Call tree:
diff --git a/jjb/shell/github-release.sh b/jjb/shell/github-release.sh
index fec3872..dddfe0c 100755
--- a/jjb/shell/github-release.sh
+++ b/jjb/shell/github-release.sh
@@ -504,7 +504,7 @@
{
local -n ref=$1; shift
local varpath="$ref"
-
+
DEST_GOPATH=${DEST_GOPATH:-}
if [ -n "$DEST_GOPATH" ]; then
mkdir -p "$GOPATH/src/$DEST_GOPATH"
@@ -939,9 +939,9 @@
## -----------------------------------------------------------------------
function my_gh()
{
- func_echo "ENTER"
+ func_echo "ENTER"
set -x
-
+
declare -a cmd=()
cmd+=("$gh_cmd")
@@ -958,7 +958,7 @@
case "$arg" in
# Modes
- -*debug)
+ -*debug)
# shellcheck disable=SC2034
declare -i -g debug=1
;;