uclahs-cds / project-method-AlgorithmEvaluation-BNCH-000082-SRCRNDSeed

GNU General Public License v2.0
1 stars 0 forks source link

Apply shellcheck fixes #112

Closed nwiltsie closed 7 months ago

nwiltsie commented 11 months ago

Shellcheck is a tool for finding problematic code in shell scripts, from syntax errors to subtle and non-intuitive pitfalls. It is also capable of automatically fixed some kinds of issues.

Eventually shellcheck will be enabled in the CI/CD checks (i.e. the linters) used by this repository. In order to ease that transition (and make your life easier!), this PR includes all code fixes that could be performed automatically.

None of these fixes have been tested - this pull request was generated by a script and should be reviewed very closely.

These changes make the shell scripts in this repository abide by the following shellcheck rules:

There were also warnings that could not be fixed automatically:


In src/test-pipeline-call-src/input/submission_script.sh line 1:
# Submission script for test running pipeline-call-SRC #3 https://github.com/uclahs-cds/project-SRC-RandomSeed/issues/3
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/test-pipeline-call-src/test-strelka2/input/strelka2_submission_script.sh line 1:
# Submission script for test running pipeline-call-SRC for strelka
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/test-pipeline-call-src/test-somaticsniper/input/submission_script.sh line 1:
# submission script for test of pipeline-call-SRC
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/sr_strelka2_battenberg_phylowgs_submission_script.sh line 1:
# Submission script for SRC pipeline (single-region mode Strelka2-Battenberg-PhyloWGS)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/sr_strelka2_battenberg_phylowgs_submission_script.sh line 21:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_strelka2_battenberg_phylowgs_submission_script.sh line 23:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_strelka2_battenberg_dpclust_submission_script.sh line 1:
# Submission script for SRC pipeline (single-region mode Strelka2-Battenberg-DPClust)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/sr_strelka2_battenberg_dpclust_submission_script.sh line 21:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_strelka2_battenberg_dpclust_submission_script.sh line 23:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/mr_strelka2_battenberg_pyclone-vi_submission_script.sh line 1:
# Submission script for SRC pipeline (multi-region mode Strelka2-Battenberg-PyClone-VI)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/mr_strelka2_battenberg_pyclone-vi_submission_script.sh line 14:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/mr_strelka2_battenberg_pyclone-vi_submission_script.sh line 16:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_mutect2_battenberg_phylowgs_submission_script.sh line 1:
# Submission script for SRC pipeline (single-region mode Mutect2-Battenberg-PhyloWGS)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/sr_mutect2_battenberg_phylowgs_submission_script.sh line 21:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_mutect2_battenberg_phylowgs_submission_script.sh line 23:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/mr_mutect2_battenberg_pyclone-vi_submission_script.sh line 1:
# Submission script for SRC pipeline (multi-region mode Mutect2-Battenberg-PyClone-VI)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/mr_mutect2_battenberg_pyclone-vi_submission_script.sh line 14:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/mr_mutect2_battenberg_pyclone-vi_submission_script.sh line 16:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_mutect2_battenberg_dpclust_submission_script.sh line 1:
# Submission script for SRC pipeline (single-region mode Mutect2-Battenberg-DPClust)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/sr_mutect2_battenberg_dpclust_submission_script.sh line 21:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_mutect2_battenberg_dpclust_submission_script.sh line 23:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_somaticsniper_battenberg_phylowgs_submission_script.sh line 1:
# Submission script for SRC pipeline (single-region mode SomaticSniper-Battenberg_Phylowgs)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/sr_somaticsniper_battenberg_phylowgs_submission_script.sh line 21:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_somaticsniper_battenberg_phylowgs_submission_script.sh line 23:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_somaticsniper_battenberg_dpclust_submission_script.sh line 1:
# Submission script for SRC pipeline (single-region mode SomaticSniper-Battenberg-DPClust)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/sr_somaticsniper_battenberg_dpclust_submission_script.sh line 21:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_somaticsniper_battenberg_dpclust_submission_script.sh line 23:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/mr_somaticsniper_battenberg_pyclone-vi_submission_script.sh line 1:
# Submission script for SRC pipeline (multi-region mode SomaticSniper-Battenberg-PyClone-VI)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/mr_somaticsniper_battenberg_pyclone-vi_submission_script.sh line 14:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/mr_somaticsniper_battenberg_pyclone-vi_submission_script.sh line 16:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_somaticsniper_battenberg_pyclone-vi_submission_script.sh line 1:
# Submission script for SRC pipeline (single-region mode SomaticSniper-Battenberg-PyClone-VI)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/sr_somaticsniper_battenberg_pyclone-vi_submission_script.sh line 3:
seeds=("51404", "366306" "423647" "838004" "50135" "628019" "97782" "253505" "659767" "13142")
      ^-- SC2054 (warning): Use spaces, not commas, to separate array elements.

In src/run-pipeline-call-src/sr_somaticsniper_battenberg_pyclone-vi_submission_script.sh line 21:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_somaticsniper_battenberg_pyclone-vi_submission_script.sh line 23:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_mutect2_battenberg_pyclone-vi_submission_script.sh line 1:
# Submission script for SRC pipeline (single-region mode Mutect2-Battenberg-PyClone-VI)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/sr_mutect2_battenberg_pyclone-vi_submission_script.sh line 21:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_mutect2_battenberg_pyclone-vi_submission_script.sh line 23:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_strelka2_battenberg_pyclone-vi_submission_script.sh line 1:
# Submission script for SRC pipeline (single-region mode Strelka2-Battenberg-PyClone-VI)
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/run-pipeline-call-src/sr_strelka2_battenberg_pyclone-vi_submission_script.sh line 21:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/run-pipeline-call-src/sr_strelka2_battenberg_pyclone-vi_submission_script.sh line 23:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/output-analysis/plotting/plotting_workflow.sh line 1:
# stripplot for relative seed variability in number of subclones called
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/output-analysis/plotting/plotting_workflow.sh line 11:
            file=$(ls ${projectdir}/pipeline-call-src/run-"${snvl}"-battenberg-"${srcl}"/output/*"${snvl}"_battenberg_"${srcl}"_${mode}.tsv -Art | tail -n 1)
                   ^-- SC2012 (info): Use find instead of ls to better handle non-alphanumeric filenames.

In src/output-analysis/parsing/run_parse_consensus_tree_PhyloWGS.sh line 1:
# Submission script for creating consensus tree (PhyloWGS) for each pipeline x sample x seed output
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

In src/output-analysis/parsing/run_parse_consensus_tree_PhyloWGS.sh line 24:
for seed in ${seeds[@]} 
            ^---------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/output-analysis/parsing/run_parse_consensus_tree_PhyloWGS.sh line 26:
    for patient in ${patients[@]} 
                   ^------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.

In src/test-parser/parser_test_script.sh line 1:
# script for testing SRC pipeline parser
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

For more information:
  https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
  https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
  https://www.shellcheck.net/wiki/SC2054 -- Use spaces, not commas, to separa...

If any of these fixes/warnings are incorrect, shellcheck can be silenced by adding a line like #shellcheck disable=<rule name> immediately before the offending line (docs).

nwiltsie commented 11 months ago

Also, you can just sidestep this issue completely by adding a .cicd-env file to the root of this repository with VALIDATE_SHELL="false" (reference). Please only do that as a last resort - linters are on your side!