eclipse-shellwax / shellwax

Shell script editor plugin for Eclipse
https://marketplace.eclipse.org/content/shellwax
Eclipse Public License 2.0
17 stars 12 forks source link

Various errors and warnings in scripts #41

Closed amurashkin17 closed 2 years ago

amurashkin17 commented 4 years ago

Syntax error: expected "}" somewhere in the file

It does not like > in % substitutions.

param=${line%% => *}        # error+warning
param=${line%%>*}           # error+warning
param=${line%%" => "*}      # OK
param=${line%% = *}         # OK

Syntax error: expected "]" somewhere in the file

It does not like spaces in unquoted array keys.

[[ ${config[$component $param]} != $item ]] || continue       # warning
[[ ${config["$component $param"]} != $item ]] || continue     # OK

Syntax error: expected "]]" somewhere in the file

It does not like - at the beginning of an expression element.

[[ $1 != -c ]] || { shift; s_current=("$@"); return; }      # error+warning
[[ $1 != "-c" ]] || { shift; s_current=("$@"); return; }    # OK

Failed to parse expression

In assignments, it does not like spaces in unquoted keys of associative arrays.

config[$component $param]=$item        # error
config["$component $param"]=$item      # OK

It does not like spaces in unquoted array keys.

Syntax error: expected "word" somewhere in the file

It does not like assignments var=;

    debug=0; run=y; prefix="###"; acuopts=;    # warning
    debug=0; run=y; prefix="###"; acuopts=     # ok
acuopts="$acuopts -$c"; let debug=debug+1; run=; prefix=+++       # warning
acuopts="$acuopts -$c"; let debug=debug+1; run=""; prefix=+++     # ok
akurtakov commented 4 years ago

These reports belong to https://github.com/tree-sitter/tree-sitter-bash like https://github.com/tree-sitter/tree-sitter-bash/issues/70 . Please report them there and once it's fixed there and bash lsp updates to this version of tree-sitter-bash shellwax will get it too.

akurtakov commented 2 years ago

No longer happens as underlying LS stepped back on some checks that raised false positivies.