Add shellcheck for bash completion

Signed-off-by: Jean-Pierre Huynh <jean-pierre.huynh@ounet.fr>
This commit is contained in:
Jean-Pierre Huynh 2017-06-29 14:10:04 +01:00 committed by Jean-Pierre Huynh
parent e3746d388e
commit b2fc35aefa
6 changed files with 133 additions and 73 deletions

View File

@ -54,6 +54,11 @@ manpages:
yamldocs:
scripts/docs/generate-yaml.sh
## Shellcheck validation
.PHONY: shellcheck
shellcheck:
scripts/validate/shellcheck
cli/compose/schema/bindata.go: cli/compose/schema/data/*.json
go generate github.com/docker/cli/cli/compose/schema

View File

@ -91,7 +91,20 @@ jobs:
docker build -f $dockerfile --tag cli-builder-with-git:$CIRCLE_BUILD_NUM .
docker run --rm cli-builder-with-git:$CIRCLE_BUILD_NUM \
make -B vendor compose-jsonschema manpages yamldocs
shellcheck:
working_directory: /work
docker: [{image: 'docker:17.05-git'}]
steps:
- checkout
- setup_remote_docker
- run:
name: "Run shellcheck"
command: |
dockerfile=dockerfiles/Dockerfile.validate
echo "COPY . ." >> $dockerfile
docker build -f $dockerfile --tag cli-validator:$CIRCLE_BUILD_NUM .
docker run --rm cli-validator:$CIRCLE_BUILD_NUM \
make -B shellcheck
workflows:
version: 2
ci:
@ -100,3 +113,4 @@ workflows:
- cross
- test
- validate
- shellcheck

View File

@ -1,4 +1,8 @@
#!/usr/bin/env bash
# shellcheck disable=SC2155
#
# Shellcheck ignore list:
# - SC2155: Declare and assign separately to avoid masking return values.
#
# bash completion file for core docker commands
#
@ -142,6 +146,7 @@ __docker_images() {
esac
local repo_print_command
# shellcheck disable=SC2016
if [ "${DOCKER_COMPLETION_SHOW_TAGS:-yes}" = "yes" ]; then
repo_print_command='print $1; print $1":"$2'
else
@ -149,6 +154,7 @@ __docker_images() {
fi
local awk_script
# shellcheck disable=SC2016
case "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" in
all|non-intermediate)
awk_script='NR>1 { print $3; if ($1 != "<none>") { '"$repo_print_command"' } }'
@ -213,6 +219,7 @@ __docker_complete_networks() {
COMPREPLY=( $(compgen -W "$(__docker_networks "$@")" -- "$current") )
}
# shellcheck disable=SC2016,SC2128,SC2178
__docker_complete_containers_in_network() {
local containers=$(__docker_q network inspect -f '{{range $i, $c := .Containers}}{{$i}} {{$c.Name}} {{end}}' "$1")
COMPREPLY=( $(compgen -W "$containers" -- "$cur") )
@ -271,6 +278,7 @@ __docker_plugins_bundled() {
for del in "${remove[@]}" ; do
plugins=(${plugins[@]/$del/})
done
# shellcheck disable=SC2145
echo "${plugins[@]} ${add[@]}"
}
@ -389,6 +397,7 @@ __docker_complete_stacks() {
# output to the IDs or names of matching items. This setting takes
# precedence over the environment setting.
# Completions may be added with `--add`, e.g. `--add self`.
# shellcheck disable=SC2016
__docker_nodes() {
local add=()
local fields='$2' # default: node name only
@ -414,7 +423,7 @@ __docker_nodes() {
esac
done
echo $(__docker_q node ls "$@" | tr -d '*' | awk "NR>1 {print $fields}") "${add[@]}"
echo "$(__docker_q node ls "$@" | tr -d '*' | awk "NR>1 {print $fields}")" "${add[@]}"
}
# __docker_complete_nodes applies completion of nodes based on the current
@ -437,6 +446,7 @@ __docker_complete_nodes() {
# An optional first option `--id|--name` may be used to limit the
# output to the IDs or names of matching items. This setting takes
# precedence over the environment setting.
# shellcheck disable=SC2016
__docker_services() {
local fields='$2' # default: service name only
[ "${DOCKER_COMPLETION_SHOW_SERVICE_IDS}" = yes ] && fields='$1,$2' # ID & name
@ -509,7 +519,7 @@ __docker_pos_first_nonflag() {
local argument_flags=$1
local counter=$((${subcommand_pos:-${command_pos}} + 1))
while [ $counter -le $cword ]; do
while [ "$counter" -le "$cword" ]; do
if [ -n "$argument_flags" ] && eval "case '${words[$counter]}' in $argument_flags) true ;; *) false ;; esac"; then
(( counter++ ))
# eat "=" in case of --option=arg syntax
@ -569,10 +579,10 @@ __docker_value_of_option() {
local option_extglob=$(__docker_to_extglob "$1")
local counter=$((command_pos + 1))
while [ $counter -lt $cword ]; do
while [ "$counter" -lt "$cword" ]; do
case ${words[$counter]} in
$option_extglob )
echo ${words[$counter + 1]}
echo "${words[$counter + 1]}"
break
;;
esac
@ -609,14 +619,14 @@ __docker_to_extglob() {
__docker_subcommands() {
local subcommands="$1"
local counter=$(($command_pos + 1))
while [ $counter -lt $cword ]; do
local counter=$((command_pos + 1))
while [ "$counter" -lt "$cword" ]; do
case "${words[$counter]}" in
$(__docker_to_extglob "$subcommands") )
subcommand_pos=$counter
local subcommand=${words[$counter]}
local completions_func=_docker_${command}_${subcommand//-/_}
declare -F $completions_func >/dev/null && $completions_func
declare -F "$completions_func" >/dev/null && "$completions_func"
return 0
;;
esac
@ -951,7 +961,7 @@ __docker_complete_signals() {
SIGUSR1
SIGUSR2
)
COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( echo $cur | tr '[:lower:]' '[:upper:]')" ) )
COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( echo "$cur" | tr '[:lower:]' '[:upper:]')" ) )
}
__docker_complete_user_group() {
@ -991,7 +1001,7 @@ _docker_docker() {
;;
*)
local counter=$( __docker_pos_first_nonflag "$(__docker_to_extglob "$global_options_with_args")" )
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_daemon_is_experimental && commands+=(${experimental_commands[*]})
COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) )
fi
@ -1044,7 +1054,7 @@ _docker_checkpoint_create() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--checkpoint-dir')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_running
fi
;;
@ -1065,7 +1075,7 @@ _docker_checkpoint_ls() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--checkpoint-dir')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_all
fi
;;
@ -1086,9 +1096,9 @@ _docker_checkpoint_rm() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--checkpoint-dir')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_all
elif [ $cword -eq $(($counter + 1)) ]; then
elif [ "$cword" -eq "$((counter + 1))" ]; then
COMPREPLY=( $( compgen -W "$(__docker_q checkpoint ls "$prev" | sed 1d)" -- "$cur" ) )
fi
;;
@ -1149,7 +1159,7 @@ _docker_container_attach() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--detach-keys')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_running
fi
;;
@ -1170,13 +1180,13 @@ _docker_container_commit() {
*)
local counter=$(__docker_pos_first_nonflag '--author|-a|--change|-c|--message|-m')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_all
return
fi
(( counter++ ))
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_image_repos_and_tags
return
fi
@ -1191,7 +1201,7 @@ _docker_container_cp() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
case "$cur" in
*:)
return
@ -1206,6 +1216,7 @@ _docker_container_cp() {
local containers=( ${COMPREPLY[@]} )
COMPREPLY=( $( compgen -W "${files[*]} ${containers[*]}" -- "$cur" ) )
# shellcheck disable=SC2128
if [[ "$COMPREPLY" == *: ]]; then
__docker_nospace
fi
@ -1215,7 +1226,7 @@ _docker_container_cp() {
fi
(( counter++ ))
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
if [ -e "$prev" ]; then
__docker_complete_containers_all
COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
@ -1240,7 +1251,7 @@ _docker_container_diff() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_all
fi
;;
@ -1252,7 +1263,7 @@ _docker_container_exec() {
case "$prev" in
--env|-e)
# we do not append a "=" here because "-e VARNAME" is legal systax, too
# we do not append a "=" here because "-e VARNAME" is legal syntax, too
COMPREPLY=( $( compgen -e -- "$cur" ) )
__docker_nospace
return
@ -1287,7 +1298,7 @@ _docker_container_export() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_all
fi
;;
@ -1329,7 +1340,7 @@ _docker_container_logs() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--since|--tail')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_all
fi
;;
@ -1425,7 +1436,7 @@ _docker_container_port() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_all
fi
;;
@ -1459,7 +1470,7 @@ _docker_container_rename() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_all
fi
;;
@ -1497,7 +1508,7 @@ _docker_container_rm() {
;;
esac
done
__docker_complete_containers_removable
__docker_complete_containers_removable "$@"
;;
esac
}
@ -1608,7 +1619,7 @@ _docker_container_run_and_create() {
--tty -t
"
if [ "$command" = "run" -o "$subcommand" = "run" ] ; then
if [ "$command" = "run" ] || [ "$subcommand" = "run" ] ; then
options_with_args="$options_with_args
--detach-keys
"
@ -1686,7 +1697,7 @@ _docker_container_run_and_create() {
return
;;
--env|-e)
# we do not append a "=" here because "-e VARNAME" is legal systax, too
# we do not append a "=" here because "-e VARNAME" is legal syntax, too
COMPREPLY=( $( compgen -e -- "$cur" ) )
__docker_nospace
return
@ -1699,6 +1710,7 @@ _docker_container_run_and_create() {
;;
*)
COMPREPLY=( $( compgen -W 'host container:' -- "$cur" ) )
# shellcheck disable=SC2128
if [ "$COMPREPLY" = "container:" ]; then
__docker_nospace
fi
@ -1753,6 +1765,7 @@ _docker_container_run_and_create() {
;;
*)
COMPREPLY=( $( compgen -W 'host container:' -- "$cur" ) )
# shellcheck disable=SC2128
if [ "$COMPREPLY" = "container:" ]; then
__docker_nospace
fi
@ -1806,8 +1819,8 @@ _docker_container_run_and_create() {
COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) )
;;
*)
local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
if [ $cword -eq $counter ]; then
local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" )
if [ "$cword" -eq "$counter" ]; then
__docker_complete_images
fi
;;
@ -1816,7 +1829,7 @@ _docker_container_run_and_create() {
_docker_container_start() {
__docker_complete_detach_keys && return
# shellcheck disable=SC2078
case "$prev" in
--checkpoint)
if [ __docker_daemon_is_experimental ] ; then
@ -1838,7 +1851,7 @@ _docker_container_start() {
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
;;
*)
__docker_complete_containers_stopped
__docker_complete_containers_stopped "$@"
;;
esac
}
@ -1884,7 +1897,7 @@ _docker_container_top() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_running
fi
;;
@ -1898,8 +1911,8 @@ _docker_container_unpause() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
__docker_complete_containers_unpauseable
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_unpauseable "$@"
fi
;;
esac
@ -2098,7 +2111,7 @@ _docker_daemon() {
return
;;
--storage-driver|-s)
COMPREPLY=( $( compgen -W "aufs btrfs devicemapper overlay overlay2 vfs zfs" -- "$(echo $cur | tr '[:upper:]' '[:lower:]')" ) )
COMPREPLY=( $( compgen -W "aufs btrfs devicemapper overlay overlay2 vfs zfs" -- "$(echo "$cur" | tr '[:upper:]' '[:lower:]')" ) )
return
;;
--storage-opt)
@ -2211,7 +2224,7 @@ _docker_export() {
_docker_help() {
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
fi
}
@ -2348,8 +2361,8 @@ _docker_image_build() {
COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) )
;;
*)
local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
if [ $cword -eq $counter ]; then
local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" )
if [ "$cword" -eq "$counter" ]; then
_filedir -d
fi
;;
@ -2369,7 +2382,7 @@ _docker_image_history() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_images
fi
;;
@ -2393,12 +2406,12 @@ _docker_image_import() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--change|-c|--message|-m')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
return
fi
(( counter++ ))
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_image_repos_and_tags
return
fi
@ -2493,7 +2506,7 @@ _docker_image_pull() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
for arg in "${COMP_WORDS[@]}"; do
case "$arg" in
--all-tags|-a)
@ -2515,7 +2528,7 @@ _docker_image_push() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_image_repos_and_tags
fi
;;
@ -2567,13 +2580,13 @@ _docker_image_tag() {
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_image_repos_and_tags
return
fi
(( counter++ ))
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_image_repos_and_tags
return
fi
@ -2737,10 +2750,10 @@ _docker_network_connect() {
COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
;;
*)
local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
if [ $cword -eq $counter ]; then
local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" )
if [ "$cword" -eq "$counter" ]; then
__docker_complete_networks
elif [ $cword -eq $(($counter + 1)) ]; then
elif [ "$cword" -eq $((counter + 1)) ]; then
__docker_complete_containers_all
fi
;;
@ -2788,9 +2801,9 @@ _docker_network_disconnect() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_networks
elif [ $cword -eq $(($counter + 1)) ]; then
elif [ "$cword" -eq $((counter + 1)) ]; then
__docker_complete_containers_in_network "$prev"
fi
;;
@ -2969,8 +2982,8 @@ _docker_service_logs() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--since|--tail')
if [ $cword -eq $counter ]; then
__docker_complete_services_and_tasks
if [ "$cword" -eq "$counter" ]; then
__docker_complete_services_and_tasks "$@"
fi
;;
esac
@ -3076,7 +3089,7 @@ _docker_service_ps() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--filter|-f')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_services
fi
;;
@ -3321,13 +3334,13 @@ _docker_service_update_and_create() {
COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
;;
*)
local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" )
if [ "$subcommand" = "update" ] ; then
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_services
fi
else
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_images
fi
fi
@ -3466,7 +3479,7 @@ _docker_swarm_join_token() {
;;
*)
local counter=$( __docker_pos_first_nonflag )
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
COMPREPLY=( $( compgen -W "manager worker" -- "$cur" ) )
fi
;;
@ -3685,7 +3698,7 @@ _docker_node_update() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--availability|--label-add|--label-rm|--role')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_nodes
fi
;;
@ -3732,10 +3745,10 @@ _docker_plugin_create() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
# reponame
return
elif [ $cword -eq $((counter + 1)) ]; then
elif [ "$cword" -eq $((counter + 1)) ]; then
_filedir -d
fi
;;
@ -3749,7 +3762,7 @@ _docker_plugin_disable() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_plugins_installed --filter enabled=true
fi
;;
@ -3769,7 +3782,7 @@ _docker_plugin_enable() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--timeout')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_plugins_installed --filter enabled=false
fi
;;
@ -3849,7 +3862,7 @@ _docker_plugin_push() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_plugins_installed
fi
;;
@ -3878,7 +3891,7 @@ _docker_plugin_set() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_plugins_installed
fi
;;
@ -3892,10 +3905,10 @@ _docker_plugin_upgrade() {
;;
*)
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_plugins_installed
__ltrim_colon_completions "$cur"
elif [ $cword -eq $((counter + 1)) ]; then
elif [ "$cword" -eq $((counter + 1)) ]; then
local plugin_images="$(__docker_plugins_installed)"
COMPREPLY=( $(compgen -S : -W "${plugin_images%:*}" -- "$cur") )
__docker_nospace
@ -3930,7 +3943,7 @@ _docker_restart() {
}
_docker_rm() {
_docker_container_rm
_docker_container_rm "$@"
}
_docker_rmi() {
@ -4189,7 +4202,7 @@ _docker_stack_ps() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--filter|-f')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_stacks
fi
;;
@ -4243,7 +4256,7 @@ _docker_stack_services() {
;;
*)
local counter=$(__docker_pos_first_nonflag '--filter|-f|--format')
if [ $cword -eq $counter ]; then
if [ "$cword" -eq "$counter" ]; then
__docker_complete_stacks
fi
;;
@ -4256,7 +4269,7 @@ _docker_stack_up() {
_docker_start() {
_docker_container_start
_docker_container_start "$@"
}
_docker_stats() {
@ -4431,7 +4444,7 @@ _docker_tag() {
}
_docker_unpause() {
_docker_container_unpause
_docker_container_unpause "$@"
}
_docker_update() {
@ -4685,7 +4698,7 @@ _docker() {
local command='docker' command_pos=0 subcommand_pos
local counter=1
while [ $counter -lt $cword ]; do
while [ "$counter" -lt "$cword" ]; do
case "${words[$counter]}" in
# save host so that completion can use custom daemon
--host|-H)

View File

@ -7,6 +7,7 @@
DEV_DOCKER_IMAGE_NAME = docker-cli-dev
LINTER_IMAGE_NAME = docker-cli-lint
CROSS_IMAGE_NAME = docker-cli-cross
VALIDATE_IMAGE_NAME = docker-cli-validate
MOUNTS = -v "$(CURDIR)":/go/src/github.com/docker/cli
VERSION = $(shell cat VERSION)
ENVVARS = -e VERSION=$(VERSION) -e GITCOMMIT
@ -25,6 +26,9 @@ build_linter_image:
build_cross_image:
docker build -t $(CROSS_IMAGE_NAME) -f ./dockerfiles/Dockerfile.cross .
.PHONY: build_validate_image
build_validate_image:
docker build -t $(VALIDATE_IMAGE_NAME) -f ./dockerfiles/Dockerfile.validate .
# build executable using a container
binary: build_docker_image
@ -80,3 +84,7 @@ manpages: build_docker_image
.PHONY: yamldocs
yamldocs: build_docker_image
docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make yamldocs
.PHONY: shellcheck
shellcheck: build_validate_image
docker run -ti --rm -v "$(CURDIR)":/tmp $(VALIDATE_IMAGE_NAME) make shellcheck

View File

@ -0,0 +1,9 @@
FROM debian:stretch-slim
RUN apt-get update && \
apt-get -y install make shellcheck && \
apt-get clean
WORKDIR /tmp
CMD bash

11
scripts/validate/shellcheck Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -e
# Maintain an array of files to shellcheck not the best solution but will do for the time being
FILES=()
FILES+=("contrib/completion/bash/docker")
FILES+=("scripts/validate/shellcheck")
for f in "${FILES[@]}"; do
shellcheck "$f"
done