lint: remove unnecessary negation

Also use double-brackets where possible.

Fixes SC2236
This commit is contained in:
Jose Diaz-Gonzalez
2019-02-02 13:52:18 -05:00
parent 67ae374e60
commit c7b71b5d92
9 changed files with 15 additions and 15 deletions

View File

@@ -168,7 +168,7 @@ dokku_container_log_verbose_quiet() {
is_valid_app_name() {
declare desc="verify app name format"
local APP="$1"
[[ ! -n "$APP" ]] && dokku_log_fail "APP must not be null"
[[ -z "$APP" ]] && dokku_log_fail "APP must not be null"
if [[ "$APP" =~ ^[a-z].* ]] || [[ "$APP" =~ ^[0-9].* ]]; then
if [[ ! $APP =~ [A-Z] ]] && [[ ! $APP =~ [:] ]]; then
return 0

View File

@@ -32,7 +32,7 @@ docker_args() {
local line
read -r line || local DONE=true
[[ ! -n "$line" ]] && continue
[[ -z "$line" ]] && continue
# shellcheck disable=SC1001
case "$line" in

View File

@@ -248,7 +248,7 @@ get_default_vhosts() {
if ! ([[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]]); then
local SUBDOMAIN=${APP/%\.${VHOST}/}
local hostname=$(: | plugn trigger nginx-hostname "$APP" "$SUBDOMAIN" "$VHOST")
if [[ ! -n $hostname ]]; then
if [[ -z $hostname ]]; then
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
local hostname="${APP/\//-}"
else

View File

@@ -25,7 +25,7 @@ enter_default_cmd() {
if [[ "$3" == "--container-id" ]]; then
local DOKKU_APP_CIDS=($(get_app_container_ids "$APP"))
if [[ ! -n "$4" ]]; then
if [[ -z "$4" ]]; then
dokku_log_warn "No container id specified."
dokku_log_fail "Available ids for app ($APP): ${DOKKU_APP_CIDS[*]}"
fi
@@ -38,7 +38,7 @@ enter_default_cmd() {
else
local DOKKU_APP_CIDS=($(get_app_container_ids "$APP" "$CONTAINER_TYPE"))
local ID=${DOKKU_APP_CIDS[0]}
if [[ ! -n $ID ]]; then
if [[ -z $ID ]]; then
dokku_log_warn "No containers found for type '$CONTAINER_TYPE'"
dokku_log_fail "Available types for app ($APP): ${AVAILABLE_CONTAINER_TYPES[*]}"
fi

View File

@@ -46,7 +46,7 @@ scheduler-docker-local-scheduler-run() {
PROC_CMD=$(get_cmd_from_procfile "$APP" "$POTENTIAL_PROCFILE_KEY" || echo '')
remove_procfile "$APP"
if [ ! -z "$PROC_CMD" ]; then
if [[ -n "$PROC_CMD" ]]; then
dokku_log_info1 "Found '$POTENTIAL_PROCFILE_KEY' in Procfile, running that command"
set -- "$PROC_CMD" "${@:2}"
fi