-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tests for shellcheck lints
- Loading branch information
1 parent
c9ef694
commit 958e222
Showing
8 changed files
with
466 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
note[CommandSectionShellCheck]: `shellcheck` reported the following diagnostic | ||
┌─ tests/lints/shellcheck-error/source.wdl:18:10 | ||
│ | ||
18 │ if [ -f "$broken"] | ||
│ ^ SC1073[error]: Couldn't parse this test expression. Fix to allow more checks. | ||
│ | ||
= fix: address the diagnostics as recommended in the message | ||
|
||
note[CommandSectionShellCheck]: `shellcheck` reported the following diagnostic | ||
┌─ tests/lints/shellcheck-error/source.wdl:18:15 | ||
│ | ||
18 │ if [ -f "$broken"] | ||
│ ^ SC1019[error]: Expected this to be an argument to the unary condition. | ||
│ | ||
= fix: address the diagnostics as recommended in the message | ||
|
||
note[CommandSectionShellCheck]: `shellcheck` reported the following diagnostic | ||
┌─ tests/lints/shellcheck-error/source.wdl:18:25 | ||
│ | ||
18 │ if [ -f "$broken"] | ||
│ ^ SC1020[error]: You need a space before the ]. | ||
│ | ||
= fix: address the diagnostics as recommended in the message | ||
|
||
note[CommandSectionShellCheck]: `shellcheck` reported the following diagnostic | ||
┌─ tests/lints/shellcheck-error/source.wdl:37:10 | ||
│ | ||
37 │ if [ -f "$broken"] | ||
│ ^ SC1073[error]: Couldn't parse this test expression. Fix to allow more checks. | ||
│ | ||
= fix: address the diagnostics as recommended in the message | ||
|
||
note[CommandSectionShellCheck]: `shellcheck` reported the following diagnostic | ||
┌─ tests/lints/shellcheck-error/source.wdl:37:15 | ||
│ | ||
37 │ if [ -f "$broken"] | ||
│ ^ SC1019[error]: Expected this to be an argument to the unary condition. | ||
│ | ||
= fix: address the diagnostics as recommended in the message | ||
|
||
note[CommandSectionShellCheck]: `shellcheck` reported the following diagnostic | ||
┌─ tests/lints/shellcheck-error/source.wdl:37:25 | ||
│ | ||
37 │ if [ -f "$broken"] | ||
│ ^ SC1020[error]: You need a space before the ]. | ||
│ | ||
= fix: address the diagnostics as recommended in the message | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#@ except: DescriptionMissing, RuntimeSectionKeys, MatchingParameterMeta, NoCurlyCommands | ||
## This is a test of having shellcheck error lints | ||
version 1.1 | ||
|
||
task test1 { | ||
meta {} | ||
|
||
parameter_meta {} | ||
|
||
input { | ||
Int placeholder | ||
} | ||
|
||
command <<< | ||
somecommand.py [[ -f $broken_test]] | ||
if [ -f "$broken"] | ||
>>> | ||
|
||
output {} | ||
|
||
runtime {} | ||
} | ||
|
||
task test2 { | ||
meta {} | ||
|
||
parameter_meta {} | ||
|
||
input { | ||
Int placeholder | ||
} | ||
|
||
command { | ||
somecommand.py [[ -f $broken_test]] | ||
if [ -f "$broken"] | ||
} | ||
|
||
output {} | ||
|
||
runtime {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
note[InputSorting]: input not sorted | ||
┌─ tests/lints/shellcheck-ok/source.wdl:12:5 | ||
│ | ||
12 │ input { | ||
│ ^^^^^ input section must be sorted | ||
│ | ||
= fix: sort input statements as: | ||
Boolean i_quote_my_shellvars | ||
Int placeholder | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#@ except: DescriptionMissing, RuntimeSectionKeys, MatchingParameterMeta, NoCurlyCommands | ||
## This is a test of having no shellcheck lints | ||
version 1.1 | ||
|
||
task test1 { | ||
meta {} | ||
|
||
parameter_meta {} | ||
|
||
input { | ||
Int placeholder | ||
Boolean i_quote_my_shellvars | ||
} | ||
|
||
command <<< | ||
set -eo pipefail | ||
|
||
echo "$placeholder" | ||
|
||
if [[ "$i_quote_my_shellvars" ]]; then | ||
echo "shellcheck will be happy" | ||
fi | ||
>>> | ||
|
||
output {} | ||
|
||
runtime {} | ||
} | ||
|
||
task test2 { | ||
meta {} | ||
|
||
parameter_meta {} | ||
|
||
input { | ||
Int placeholder | ||
} | ||
|
||
command { | ||
set -eo pipefail | ||
|
||
echo "$placeholder" | ||
|
||
if [[ "$I_quote_my_shellvars" ]]; then | ||
echo "all is well" | ||
fi | ||
} | ||
|
||
output {} | ||
|
||
runtime {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
note[CommandSectionShellCheck]: `shellcheck` reported the following diagnostic | ||
┌─ tests/lints/shellcheck-style/source.wdl:17:7 | ||
│ | ||
17 │ [[ ]] | ||
│ ^^^ SC2212[style]: Use 'false' instead of empty [/[[ conditionals. | ||
│ | ||
= fix: address the diagnostics as recommended in the message | ||
|
||
note[CommandSectionShellCheck]: `shellcheck` reported the following diagnostic | ||
┌─ tests/lints/shellcheck-style/source.wdl:18:9 | ||
│ | ||
18 │ [ true ] | ||
│ ^^^^ SC2160[style]: Instead of '[ true ]', just use 'true'. | ||
│ | ||
= fix: address the diagnostics as recommended in the message | ||
|
||
note[CommandSectionShellCheck]: `shellcheck` reported the following diagnostic | ||
┌─ tests/lints/shellcheck-style/source.wdl:36:7 | ||
│ | ||
36 │ [[ ]] | ||
│ ^^^ SC2212[style]: Use 'false' instead of empty [/[[ conditionals. | ||
│ | ||
= fix: address the diagnostics as recommended in the message | ||
|
||
note[CommandSectionShellCheck]: `shellcheck` reported the following diagnostic | ||
┌─ tests/lints/shellcheck-style/source.wdl:37:9 | ||
│ | ||
37 │ [ true ] | ||
│ ^^^^ SC2160[style]: Instead of '[ true ]', just use 'true'. | ||
│ | ||
= fix: address the diagnostics as recommended in the message | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#@ except: DescriptionMissing, RuntimeSectionKeys, MatchingParameterMeta, NoCurlyCommands | ||
## This is a test of having shellcheck style lints | ||
version 1.1 | ||
|
||
task test1 { | ||
meta {} | ||
|
||
parameter_meta {} | ||
|
||
input { | ||
Int placeholder | ||
} | ||
|
||
command <<< | ||
[[ ]] | ||
[ true ] | ||
>>> | ||
|
||
output {} | ||
|
||
runtime {} | ||
} | ||
|
||
task test2 { | ||
meta {} | ||
|
||
parameter_meta {} | ||
|
||
input { | ||
Int placeholder | ||
} | ||
|
||
command { | ||
[[ ]] | ||
[ true ] | ||
} | ||
|
||
output {} | ||
|
||
runtime {} | ||
} |
Oops, something went wrong.