Skip to content

Commit ae7ce49

Browse files
authored
Merge pull request #245 from tegonal/improve/move-not-into-arithmetic-expresison
move the ! into the arithmetic expression
2 parents 64d359a + 82d72e7 commit ae7ce49

File tree

11 files changed

+21
-21
lines changed

11 files changed

+21
-21
lines changed

src/qa/run-shellcheck-pull-hooks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ sourceOnce "$dir_of_tegonal_scripts/qa/run-shellcheck.sh"
3939

4040
#TODO remove file, runShellcheckPullHooks is no also in run-shellcheck.sh
4141
function runShellcheckPullHooks() {
42-
if ! (($# == 1)); then
42+
if (($# != 1)); then
4343
logError "Exactly one parameter needs to be passed to runShellcheckPullHooks, given \033[0;36m%s\033[0m\nFollowing a description of the parameters:" "$#"
4444
echo >&2 '1: gt_dir working directory of gt'
4545
printStackTrace

src/qa/run-shellcheck.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function runShellcheck() {
114114
}
115115

116116
function runShellcheckPullHooks() {
117-
if ! (($# == 1)); then
117+
if (($# != 1)); then
118118
logError "Exactly one parameter needs to be passed to runShellcheckPullHooks, given \033[0;36m%s\033[0m\nFollowing a description of the parameters:" "$#"
119119
echo >&2 '1: gt_dir working directory of gt'
120120
printStackTrace

src/utility/array-utils.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ joinByString() {
8484
}
8585

8686
function arrFilter() {
87-
if ! (($# == 3)); then
87+
if (($# != 3)); then
8888
logError "Three arguments needs to be passed to arrFilter, given \033[0;36m%s\033[0m\n" "$#"
8989
echo >&2 '1: arrayIn name of the array to filter'
9090
echo >&2 '2: arrayOut name of the array which will contain the result'
@@ -112,7 +112,7 @@ function arrFilter() {
112112
}
113113

114114
function arrTakeEveryX() {
115-
if ! (($# == 4)); then
115+
if (($# != 4)); then
116116
logError "Four arguments needs to be passed to arrTakeEveryX, given \033[0;36m%s\033[0m\n" "$#"
117117
echo >&2 '1: arrayIn name of the array to filter'
118118
echo >&2 '2: arrayOut name of the array which will contain the result'
@@ -139,7 +139,7 @@ function arrTakeEveryX() {
139139
}
140140

141141
function arrStringEntryMaxLength() {
142-
if ! (($# == 1)); then
142+
if (($# != 1)); then
143143
logError "One argument needs to be passed to arrStringEntryMaxLength, given \033[0;36m%s\033[0m\n" "$#"
144144
echo >&2 '1: array name of the array which contains strings'
145145
printStackTrace

src/utility/checks.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ sourceOnce "$dir_of_tegonal_scripts/utility/parse-fn-args.sh"
9292
sourceOnce "$dir_of_tegonal_scripts/utility/recursive-declare-p.sh"
9393

9494
function checkArgIsArray() {
95-
if ! (($# == 2)); then
95+
if (($# != 2)); then
9696
logError "Two arguments needs to be passed to checkArgIsArray, given \033[0;36m%s\033[0m\n" "$#"
9797
echo >&2 '1: array name of the array to check'
9898
echo >&2 '2: argNumberOrName what argument do we check (used in error message)'
@@ -133,7 +133,7 @@ function exitIfArgIsNotArrayOrIsEmpty() {
133133
}
134134

135135
function checkArgIsArrayWithTuples() {
136-
if ! (($# == 5)); then
136+
if (($# != 5)); then
137137
logError "Five arguments needs to be passed to checkArgIsArrayWithTuples, given \033[0;36m%s\033[0m\n" "$#"
138138
echo >&2 '1: array name of the array to check'
139139
echo >&2 '2: tupleNum the number of values of each tuple'
@@ -281,7 +281,7 @@ function checkArgIsVersion() {
281281
}
282282

283283
function checkCommandExists() {
284-
if ! (($# == 1 || $# == 2)); then
284+
if (($# != 1 && $# != 2)); then
285285
traceAndDie "you need to pass the name of the command to check to checkCommandExists and optionally an additional hint (e.g. install via...)"
286286
fi
287287
local -r name=$1
@@ -316,7 +316,7 @@ function exitIfVariablesNotDeclared() {
316316
}
317317

318318
function checkPathIsInsideOf() {
319-
if ! (($# == 2)); then
319+
if (($# != 2)); then
320320
logError "Two arguments needs to be passed to checkPathIsInsideOf, given \033[0;36m%s\033[0m\n" "$#"
321321
echo >&2 '1: pathToCheck the path which should be inside of rootDir'
322322
echo >&2 '2: rootDir the root directory'

src/utility/cleanups.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if ! [[ -v dir_of_tegonal_scripts ]]; then
4343
fi
4444

4545
function removeUnusedSignatures() {
46-
if ! (($# == 1)); then
46+
if (($# != 1)); then
4747
logError "One argument needs to be passed to removeUnusedSignatures, given \033[0;36m%s\033[0m\n" "$#"
4848
echo >&2 '1: projectDir the path to the root directory of the project'
4949
printStackTrace

src/utility/git-utils.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function countCommits() {
103103
}
104104

105105
function localGitIsAhead() {
106-
if ! (($# == 1)) && ! (($# == 2)); then
106+
if (($# != 1)) && (($# != 2)); then
107107
traceAndDie "you need to pass at least the branch name to localGitIsAhead and optionally the name of the remote (defaults to origin) but not more, given: %s" "$#"
108108
fi
109109
local -r branch=$1
@@ -115,7 +115,7 @@ function localGitIsAhead() {
115115
}
116116

117117
function localGitIsBehind() {
118-
if ! (($# == 1)) && ! (($# == 2)); then
118+
if (($# != 1)) && (($# != 2)); then
119119
traceAndDie "you need to pass at least the branch name to localGitIsBehind and optionally the name of the remote (defaults to origin) but not more, given: %s" "$#"
120120
fi
121121
local -r branch=$1
@@ -127,7 +127,7 @@ function localGitIsBehind() {
127127
}
128128

129129
function hasRemoteTag() {
130-
if ! (($# == 1)) && ! (($# == 2)); then
130+
if (($# != 1)) && (($# != 2)); then
131131
traceAndDie "you need to pass at least the tag to hasRemoteTag and optionally the name of the remote (defaults to origin) but not more, given: %s" "$#"
132132
fi
133133
local -r tag=$1

src/utility/parse-args.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function parse_args_describeParameterTriple() {
9595
}
9696

9797
function parse_args_exitIfParameterDefinitionIsNotTriple() {
98-
if ! (($# == 1)); then
98+
if (($# != 1)); then
9999
logError "One argument needs to be passed to parse_args_exitIfParameterDefinitionIsNotTriple, given \033[0;36m%s\033[0m\nFollowing a description of the parameters:" "$#"
100100
echo >&2 '1: params the name of an array which contains the parameter definitions'
101101
printStackTrace
@@ -207,7 +207,7 @@ function parseArgumentsInternal {
207207
}
208208

209209
function parse_args_printHelp {
210-
if ! (($# == 4)); then
210+
if (($# != 4)); then
211211
logError "Three arguments need to be passed to parse_args_printHelp, given \033[0;36m%s\033[0m\nFollowing a description of the parameters:" "$#"
212212
echo >&2 '1: params the name of an array which contains the parameter definitions'
213213
echo >&2 '2: examples a string containing examples (or an empty string)'
@@ -256,7 +256,7 @@ function parse_args_printHelp {
256256
}
257257

258258
function exitIfNotAllArgumentsSet {
259-
if ! (($# == 3)) && ! (($# == 4)); then
259+
if (($# != 3)) && (($# != 4)); then
260260
logError "Three arguments need to be passed to exitIfNotAllArgumentsSet, given \033[0;36m%s\033[0m\nFollowing a description of the parameters:" "$#"
261261
echo >&2 '1: params the name of an array which contains the parameter definitions'
262262
echo >&2 '2: examples a string containing examples (or an empty string)'

src/utility/parse-commands.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function parse_commands_describeParameterPair() {
9090
}
9191

9292
function parse_commands_checkParameterDefinitionIsPair() {
93-
if ! (($# == 1)); then
93+
if (($# != 1)); then
9494
logError "One parameter needs to be passed to parse_commands_checkParameterDefinitionIsPair, given \033[0;36m%s\033[0m\nFollowing a description of the parameters:" "$#"
9595
echo >&2 '1: params the name of an array which contains the command definitions'
9696
printStackTrace
@@ -152,7 +152,7 @@ function parseCommands {
152152
}
153153

154154
function parse_commands_printHelp() {
155-
if ! (($# == 2)); then
155+
if (($# != 2)); then
156156
logError "Two arguments need to be passed to parse_commands_help, given \033[0;36m%s\033[0m\nFollowing a description of the parameters:" "$#"
157157
echo >&2 '1: commands the name of an array which contains the command definitions'
158158
echo >&2 '2: version the version which shall be shown if one uses --version'

src/utility/parse-fn-args.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function parseFnArgs() {
114114
exit 9
115115
fi
116116

117-
if [[ $parseFnArgs_withVarArgs == false ]] && ! (($# == ${#parseFnArgs_paramArr1[@]})); then
117+
if [[ $parseFnArgs_withVarArgs == false ]] && (($# != ${#parseFnArgs_paramArr1[@]})); then
118118
logError "more arguments supplied to \033[0m\033[0;36m%s\033[0m than expected\nExpected %s, given %s" \
119119
"${FUNCNAME[1]}" "${#parseFnArgs_paramArr1[@]}" "$#"
120120
echo >&2 "in case you wanted your last parameter to be a vararg parameter, then use 'varargs' as last variable name in your array containing the parameter names."

src/utility/recursive-declare-p.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ if ! [[ -v dir_of_tegonal_scripts ]]; then
5454
fi
5555

5656
function recursiveDeclareP() {
57-
if ! (($# == 1)); then
57+
if (($# != 1)); then
5858
traceAndDie "you need to pass the variable name, whose declaration statement shall be determined, to recursiveDeclareP"
5959
fi
6060

0 commit comments

Comments
 (0)