facebook pixelCodiga Analysis Shell Rules, severity critical , category error prone
BACK TO LIST

Shell rules

Bash, zsh, ksh: regardless what Shell you use, Codiga got you covered. With hundreds of rules, the Codiga Static Engine checks for any issue in your shell script and surfaces issues in your Shell codebase.

1017

Error prone
Critical

Literal carriage return. Run script through tr -d '\\r' .

1018

Error prone
Critical

This is a unicode non-breaking space. Delete and retype it.

1019

Error prone
Critical

Expected this to be an argument to the unary condition.

Learn more

1020

Error prone
Critical

You need a space before the ]].

1035

Error prone
Critical

You are missing a required space after the !.

1036

Error prone
Critical

(' is invalid here. Did you forget to escape it?

1046

Error prone
Critical

Couldn't find 'fi' for this 'if'.

1047

Error prone
Critical

Expected 'fi' matching previously mentioned 'if'.

1048

Error prone
Critical

Can't have empty else clauses (use 'true' as a no-op).

1049

Error prone
Critical

Did you forget the 'then' for this 'if'?

1050

Error prone
Critical

Expected 'then'.

1054

Error prone
Critical

You need a space after the '{'.

1055

Error prone
Critical

You need at least one command here. Use 'true;' as a no-op.

1056

Error prone
Critical

Expected a '}'. If you have one

1058

Error prone
Critical

Expected 'do'.

1061

Error prone
Critical

Couldn't find 'done' for this 'do'.

1062

Error prone
Critical

Expected 'done' matching previously mentioned 'do'.

1064

Error prone
Critical

Expected a { to open the function definition.

1065

Error prone
Critical

Trying to declare parameters? Don't. Use () and refer to params as $1

1066

Error prone
Critical

Don't use $ on the left side of assignments.

1070

Error prone
Critical

Parsing stopped here. Mismatched keywords or invalid parentheses?

1071

Error prone
Critical

ShellCheck only supports sh/bash/dash/ksh scripts. Sorry!

1072

Error prone
Critical

Expected 'then'. Fix any mentioned problems and try again.

1073

Error prone
Critical

Couldn't parse this escaped char. Fix to allow more checks.

1075

Error prone
Critical

Use 'elif' instead of 'else if' (or put 'if' on new line if nesting).

1080

Error prone
Critical

You need \\ before line feeds to break lines in [ ].

1082

Error prone
Critical

This file has a UTF-8 BOM. Remove it with: LC\_CTYPE=C sed '1s/^...//' < yourscript .

1084

Error prone
Critical

Use #! and not !# for shebang

1086

Error prone
Critical

Don't use $ on the iterator name in for loops.

1088

Error prone
Critical

Parsing stopped here. Invalid use of parentheses?

1089

Error prone
Critical

Parsing stopped here. Is this keyword correctly matched up?

1095

Error prone
Critical

You need a space or linefeed between the function name and body.

1101

Error prone
Critical

Delete trailing spaces after \\ to break line (or use quotes for literal space).

1104

Error prone
Critical

Use #! and not ! for shebang

1113

Error prone
Critical

Use #! for the shebang

1115

Error prone
Critical

Remove spaces between # and ! in the shebang.

1116

Error prone
Critical

Missing $ on a $((..)) expression? (or use ( ( for arrays).

1119

Error prone
Critical

Add a linefeed between end token and terminating ')'.

1126

Error prone
Critical

Place shellcheck directives before commands

1127

Error prone
Critical

Was this intended as a comment? Use # in sh.

1128

Error prone
Critical

The shebang must be on the first line. Delete blanks and move comments.

2066

Error prone
Critical

Since you double quoted this

2067

Error prone
Critical

Missing ';' or + terminating -exec. You can't use |/||/&&

2070

Error prone
Critical

-n doesn't work with unquoted arguments. Quote or use [[ ]].

2072

Error prone
Critical

Decimals are not supported. Either use integers only

2076

Error prone
Critical

Don't quote rhs of =~

2077

Error prone
Critical

You need spaces around the comparison operator.

2078

Error prone
Critical

This expression is constant. Did you forget a $ somewhere?

2081

Error prone
Critical

[ .. ] can't match globs. Use [[ .. ]] or case statement.

2082

Error prone
Critical

To expand via indirection

2096

Error prone
Critical

On most OS, shebangs can only specify a single parameter

2104

Error prone
Critical

In functions, use return instead of break

2105

Error prone
Critical

continue is only valid in loops.

2142

Error prone
Critical

Aliases can't use positional parameters. Use a function.

2144

Error prone
Critical

-e doesn't work with globs. Use a for loop.

2152

Error prone
Critical

Can only return 0-255. Other data should be written to stdout.

2157

Error prone
Critical

Argument to -z is always false due to literal strings.

2168

Error prone
Critical

local' is only valid in functions.

2173

Error prone
Critical

SIGKILL/SIGSTOP can not be trapped.

2199

Error prone
Critical

Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @).

2203

Error prone
Critical

Globs are ignored in [[ ]] except right of =/!=. Use a loop.

2225

Error prone
Critical

This cp has no destination. Check the arguments.

2242

Error prone
Critical

Can only exit with status 0-255. Other data should be written to stdout/stderr.

2246

Error prone
Critical

This shebang specifies a directory. Ensure the interpreter is a file