soumya92/barista

View on GitHub
test.sh

Summary

Maintainability
Test Coverage

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
Open

        -timeout 90s \
Severity: Minor
Found in test.sh by shellcheck

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.

Problematic code:

var='This is long \
piece of text'

Correct code:

var='This is a long '\
'piece of text'

Rationale:

You have a single quoted string containing a backslash followed by a linefeed (newline). Unlike double quotes or unquoted strings, this has no special meaning. The string will contain a literal backslash and a linefeed.

If you wanted to break the line but not add a linefeed to the string, stop the single quote, break the line, and reopen it. This is demonstrated in the correct code.

If you wanted to break the line and also include the linefeed as a literal, you don't need a backslash:

var='This is a multi-line string
with an embedded linefeed'

Exceptions:

If you do want a string containing a literal backslash+linefeed combo, such as with sed, you can [[ignore]] this warning.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
Open

    go test \
Severity: Minor
Found in test.sh by shellcheck

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.

Problematic code:

var='This is long \
piece of text'

Correct code:

var='This is a long '\
'piece of text'

Rationale:

You have a single quoted string containing a backslash followed by a linefeed (newline). Unlike double quotes or unquoted strings, this has no special meaning. The string will contain a literal backslash and a linefeed.

If you wanted to break the line but not add a linefeed to the string, stop the single quote, break the line, and reopen it. This is demonstrated in the correct code.

If you wanted to break the line and also include the linefeed as a literal, you don't need a backslash:

var='This is a multi-line string
with an embedded linefeed'

Exceptions:

If you do want a string containing a literal backslash+linefeed combo, such as with sed, you can [[ignore]] this warning.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
Open

        -coverprofile=profiles/$(echo "PKG" | sed -e "s|./||" -e "s|/|_|g").out \
Severity: Minor
Found in test.sh by shellcheck

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.

Problematic code:

var='This is long \
piece of text'

Correct code:

var='This is a long '\
'piece of text'

Rationale:

You have a single quoted string containing a backslash followed by a linefeed (newline). Unlike double quotes or unquoted strings, this has no special meaning. The string will contain a literal backslash and a linefeed.

If you wanted to break the line but not add a linefeed to the string, stop the single quote, break the line, and reopen it. This is demonstrated in the correct code.

If you wanted to break the line and also include the linefeed as a literal, you don't need a backslash:

var='This is a multi-line string
with an embedded linefeed'

Exceptions:

If you do want a string containing a literal backslash+linefeed combo, such as with sed, you can [[ignore]] this warning.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
Open

        "PKG" \
Severity: Minor
Found in test.sh by shellcheck

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.

Problematic code:

var='This is long \
piece of text'

Correct code:

var='This is a long '\
'piece of text'

Rationale:

You have a single quoted string containing a backslash followed by a linefeed (newline). Unlike double quotes or unquoted strings, this has no special meaning. The string will contain a literal backslash and a linefeed.

If you wanted to break the line but not add a linefeed to the string, stop the single quote, break the line, and reopen it. This is demonstrated in the correct code.

If you wanted to break the line and also include the linefeed as a literal, you don't need a backslash:

var='This is a multi-line string
with an embedded linefeed'

Exceptions:

If you do want a string containing a literal backslash+linefeed combo, such as with sed, you can [[ignore]] this warning.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
Open

        -covermode=atomic \
Severity: Minor
Found in test.sh by shellcheck

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.

Problematic code:

var='This is long \
piece of text'

Correct code:

var='This is a long '\
'piece of text'

Rationale:

You have a single quoted string containing a backslash followed by a linefeed (newline). Unlike double quotes or unquoted strings, this has no special meaning. The string will contain a literal backslash and a linefeed.

If you wanted to break the line but not add a linefeed to the string, stop the single quote, break the line, and reopen it. This is demonstrated in the correct code.

If you wanted to break the line and also include the linefeed as a literal, you don't need a backslash:

var='This is a multi-line string
with an embedded linefeed'

Exceptions:

If you do want a string containing a literal backslash+linefeed combo, such as with sed, you can [[ignore]] this warning.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

Expressions don't expand in single quotes, use double quotes for that.
Open

'for try in `seq 1 3`; do 
Severity: Minor
Found in test.sh by shellcheck

Expressions don't expand in single quotes, use double quotes for that.

Problematic code:

name=World
echo 'Hello $name'

Correct code:

name=World
echo "Hello $name"

Rationale:

Single quotes prevent expansion of everything, including variables and command substitution.

If you want to use the values of variables and such, use double quotes instead.

Note that if you have other items that needs single quoting, you can use both in a single word:

echo '$1 USD is '"$rate GBP"

Exceptions

If you want $stuff to be a literal dollar sign followed by the characters "stuff", you can [[ignore]] this message.

ShellCheck tries to be smart about it, and won't warn when this is used with awk, perl and similar, but there are some inherent ambiguities like 'I have $1 in my wallet', which could be "one dollar" or "whatever's in the first parameter".

In the particular case of sed, ShellCheck uses additional heuristics to try to separate cases like 's/$foo/bar/' (failing to replace the variable $foo) with from the false positives like '$d' (delete last line). If you're still triggering these, consider being more generous with your spaces: use $ { s/foo/bar; } instead of ${s/foo/bar/;}

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

There are no issues that match your filters.

Category
Status