vlajos/misspell-fixer

View on GitHub

Showing 3 of 44 total issues

Tips depend on target shell and yours is unknown. Add a shebang.
Open

function prepare_rules_for_prefiltering {
Severity: Minor
Found in lib/main_functions.sh by shellcheck

Tips depend on target shell and yours is unknown. Add a shebang.

Problematic code:

echo "$RANDOM"   # Does this work?

Correct code:

#!/bin/sh
echo "$RANDOM"  # Unsupported in sh. Produces warning.

or

#!/bin/bash
echo "$RANDOM"  # Supported in bash. No warnings.

Rationale:

Different shells support different features. To give effective advice, ShellCheck needs to know which shell your script is going to run on. You will get a different numbers of warnings about different things depending on your target shell.

ShellCheck normally determines your target shell from the shebang (having e.g. #!/bin/sh as the first line). The shell can also be specified from the CLI with -s, e.g. shellcheck -s sh file.

If you don't specify shebang nor -s, ShellCheck gives this message and proceeds with some default (bash).

Note that this error can not be ignored with a [[directive]]. It is not a suggestion to improve your script, but a warning that ShellCheck lacks information it needs to be helpful.

Exceptions

None. Please either add a shebang or use -s.

Notice

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

Shells disambiguate $(( differently or not at all. For $(command substition), add space after $( . For $((arithmetics)), fix parsing errors.
Open

    GREP=$((ugrep --version >/dev/null 2>&1 && echo 'ugrep') \
Severity: Minor
Found in lib/initialisation_functions.sh by shellcheck

Shells disambiguate $(( differently or not at all. If the first $( should start command substitution, add a space after it.

Problematic code:

echo "$((cmd "$@") 2>&1)"

Correct code:

echo "$( (cmd "$@") 2>&1)"

Rationale:

You appear to be using $(( with two (or more) parentheses in a row, where the first $( should open a subshell.

This is an ill-defined structure that is parsed differently between different shells and shell versions. Prefer adding spaces to make it unambiguous, both to shells and humans.

Consider the $((( in $(((1)) ):

Ash, dash and Bash 1 parses it as $(( ( and subsequently fail to find the matching )). Zsh and Bash 2+ looks ahead and parses it as $( ((. Ksh parses it as $( ( (.

Exceptions:

Alternatively, you may indeed have correctly spaced your parentheses, but ShellCheck failed to parse $(( as an arithmetic expression while accidentally succeeding in parsing it as $( + (.

In these cases, double check the syntax to ensure ShellCheck can parse the $((, or ignore this error and hope that it won't affect analysis too severely.

Notice

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

Tips depend on target shell and yours is unknown. Add a shebang.
Open

function warning {
Severity: Minor
Found in lib/initialisation_functions.sh by shellcheck

Tips depend on target shell and yours is unknown. Add a shebang.

Problematic code:

echo "$RANDOM"   # Does this work?

Correct code:

#!/bin/sh
echo "$RANDOM"  # Unsupported in sh. Produces warning.

or

#!/bin/bash
echo "$RANDOM"  # Supported in bash. No warnings.

Rationale:

Different shells support different features. To give effective advice, ShellCheck needs to know which shell your script is going to run on. You will get a different numbers of warnings about different things depending on your target shell.

ShellCheck normally determines your target shell from the shebang (having e.g. #!/bin/sh as the first line). The shell can also be specified from the CLI with -s, e.g. shellcheck -s sh file.

If you don't specify shebang nor -s, ShellCheck gives this message and proceeds with some default (bash).

Note that this error can not be ignored with a [[directive]]. It is not a suggestion to improve your script, but a warning that ShellCheck lacks information it needs to be helpful.

Exceptions

None. Please either add a shebang or use -s.

Notice

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

Severity
Category
Status
Source
Language