Open HenrikBengtsson opened 2 years ago
Which version of shellcheck are you using? Are you using -x flag? I use 0.7.2
[jocostello@c4-dev2 repo]$ shellcheck --version
ShellCheck - shell script analysis tool
version: 0.7.2
I started removing
# shellcheck source=scripts/utils.sh
because it doesn't work.
Here is an experiment with Align_fastq.pbs
Case 1
#!/bin/bash
source "${LG3_HOME:?}/scripts/utils.sh"
source_lg3_conf
[jocostello@c4-dev2 repo]$ shellcheck Align_fastq.pbs
In Align_fastq.pbs line 3:
source "${LG3_HOME:?}/scripts/utils.sh"
^-- SC1091: Not following: ./scripts/utils.sh was not specified as input (see shellcheck -x).
[jocostello@c4-dev2 repo]$ shellcheck -x Align_fastq.pbs
[no message, so -x disables SC1091 warning ]
Case 2
#!/bin/bash
# shellcheck source=scripts/utils.sh
source "${LG3_HOME:?}/scripts/utils.sh"
source_lg3_conf
[jocostello@c4-dev2 repo]$ shellcheck Align_fastq.pbs
In Align_fastq.pbs line 4:
source "${LG3_HOME:?}/scripts/utils.sh"
^-- SC1091: Not following: scripts/utils.sh was not specified as input (see shellcheck -x).
So, adding "# shellcheck source=scripts/utils.sh" didn't help!?
But -x helps again:
[jocostello@c4-dev2 repo]$ shellcheck -x Align_fastq.pbs
[no warning]
What am I missing??
I started removing
# shellcheck source=scripts/utils.sh
because it doesn't work.
Please talk to me before you turn to these ad-hoc workarounds. I'm only adding things that I have tested very careful, so please assume it should work. If you think there's a bug, please post an issue and we'll discuss.
The checks can be run locally using:
$ make check
If you look at the Makefile, you'll see that it uses shellcheck -x ...
, i.e. if you run manually, then yes, you should use -x
. You can also see the CI checks that run on GitHub Actions uses this, cf. https://github.com/UCSF-Costello-Lab/LG3_Pipeline/runs/3798024504?check_suite_focus=true#step:4:1.
Hi again.
Issue
I see that you've dropped the most essential ShellCheck
source
directive:in basically all files. That is the reason why you got SC1091 warnings. So, the proper solution is to keep the above directive and not disable SC1091 checks.
For example,
Action
Please add back: