Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All templated bash scripts should be "robust" and shellcheck-clean #166

Open
yarikoptic opened this issue Jan 4, 2024 · 0 comments
Open
Labels
bug Issues noting problems and PRs fixing those problems.

Comments

@yarikoptic
Copy link
Collaborator

Summary

ATM produced shell scripts do not adhere to the best practices of writing shell scripts . You can use https://www.shellcheck.net/ tool to see what is wrong with them, e.g.

here is an example of running on a sample produced script
❯ shellcheck /home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup/call_test_job.sh

In /home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup/call_test_job.sh line 7:
echo I\'m in $PWD using `which python`
             ^--^ SC2086 (info): Double quote to prevent globbing and word splitting.
                        ^------------^ SC2046 (warning): Quote this to prevent word splitting.
                        ^------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
echo I\'m in "$PWD" using $(which python)


In /home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup/call_test_job.sh line 8:
path_check_setup=/home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup
^--------------^ SC2034 (warning): path_check_setup appears unused. Verify use (or export if used externally).


In /home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup/call_test_job.sh line 18:
which_python=`which python`
             ^------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: 
which_python=$(which python)


In /home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup/call_test_job.sh line 20:
echo 'Calling `test_job.py`...'
     ^------------------------^ SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.


In /home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup/call_test_job.sh line 21:
${which_python} /home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup/test_job.py --path-workspace ${current_pwd} --path-check-setup /home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup
                                                                                                                                         ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
${which_python} /home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup/test_job.py --path-workspace "${current_pwd}" --path-check-setup /home/yoh/proj/misc/babs/.testdata/babs_test_project/test_project/analysis/code/check_setup

For more information:
  https://www.shellcheck.net/wiki/SC2034 -- path_check_setup appears unused. ...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2016 -- Expressions don't expand in singl...
@yarikoptic yarikoptic added the bug Issues noting problems and PRs fixing those problems. label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues noting problems and PRs fixing those problems.
Projects
None yet
Development

No branches or pull requests

1 participant