Skip to content

V492 dev18 shellcheck info#147

Merged
GernotMaier merged 5 commits into
v492-dev18-shellcheckfrom
v492-dev18-shellcheck-info
May 31, 2026
Merged

V492 dev18 shellcheck info#147
GernotMaier merged 5 commits into
v492-dev18-shellcheckfrom
v492-dev18-shellcheck-info

Conversation

@GernotMaier
Copy link
Copy Markdown
Member

No description provided.

GernotMaier and others added 3 commits May 30, 2026 21:29
Resolved all 1339 shellcheck info-level issues across 116 shell scripts.
Zero issues remain at --severity=info.

Main fix categories:
- SC2086 (1259): Quote single-value variables; suppress intentional
  word-splits with inline disable comments
- SC2012 (26): Replace ls-based file discovery with find
- SC1091 (24): Add shellcheck source=/dev/null before sourced files
- SC2196 (11): Replace deprecated egrep with grep -E
- SC2153 (6): Fix variable name typos / suppress false positives
- SC2021 (4): Fix [A-z] character ranges to [A-Za-z]
- SC2162 (2): Add -r flag to read commands
- SC2231 (2): Quote expansions in case patterns
- SC2030/SC2031 (2): Fix subshell variable visibility bug in
  RUNLIST.whichRunsAreAtmosphere.sh
- SC2013 (1): Replace for-in-$(cat) with while read loop
- SC2269 (1): Remove self-assignment
- SC2329 (1): Fix always-true expression

Update CI to use --severity=info (stricter than the previous --severity=warning).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repository’s shell scripts to pass ShellCheck at info severity and updates CI to enforce that stricter lint level.

Changes:

  • Raise CI ShellCheck severity from warning to info.
  • Apply widespread ShellCheck-driven cleanups across scripts/** (quoting fixes, safer read -r, $(...) instead of backticks, || exit 1, find instead of ls in counts).
  • Add targeted ShellCheck directives (# shellcheck disable=..., # shellcheck source=/dev/null) where refactoring wasn’t performed.

Reviewed changes

Copilot reviewed 117 out of 117 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/UTILITY.sortRunsInSubDirectories.sh Adds ShellCheck directive for SC2086.
scripts/UTILITY.downloadSoundingDatafromUWYO.sh Adds SC2086 directive; arithmetic-loop cleanup.
scripts/SPANALYSIS.make_DST.sh ShellCheck fixes (`
scripts/SPANALYSIS.lowgainped.sh ShellCheck fixes (`
scripts/SPANALYSIS.evndisp_tzeros.sh ShellCheck fixes (`
scripts/SPANALYSIS.evndisp_pedestal_events.sh ShellCheck fixes (`
scripts/SPANALYSIS.evndisp_laser_runs_from_runlist.sh ShellCheck fixes (`
scripts/SPANALYSIS.evndisp_laser_runs_from_calibfile.sh ShellCheck fixes (`
scripts/SPANALYSIS.evndisp_laser_run.sh ShellCheck fixes (`
scripts/set_environment.sh Adds shellcheck source annotations; $(pwd) change.
scripts/RUNLIST.whichRunsAreWobble.sh ShellCheck fixes ($(...), grep -E, tr classes, arithmetic).
scripts/RUNLIST.whichRunsAreSource.sh ShellCheck fixes ($(...), grep -E, arithmetic).
scripts/RUNLIST.whichRunsAreOnDisk.sh ShellCheck fixes ($(...), grep -E, arithmetic; find in counts).
scripts/RUNLIST.whichRunsAreObservingMode.sh ShellCheck fixes ($(...), grep -E, arithmetic).
scripts/RUNLIST.whichRunsAreAtmosphere.sh ShellCheck fixes ($(...), read -r loop, grep -E, arithmetic).
scripts/RUNLIST.whichRunsAreArrayEpoch.sh ShellCheck fixes ($(...)).
scripts/RUNLIST.preprocessing.sh ShellCheck fixes (`
scripts/RUNLIST.generate.sh ShellCheck fixes (`
scripts/RUNLIST.findDBSourceNames.sh ShellCheck fixes (`
scripts/RUNLIST.findDBSourceCoordinates.sh ShellCheck fixes ($(...), grep -E).
scripts/RUNLIST.findBackgroundRuns.sh ShellCheck fixes (`
scripts/preprocessing/processing_dqm.sh Replaces `ls
scripts/preprocessing/print_processed_runstatistics.sh Adds SC2086 to ShellCheck disable list.
scripts/preprocessing/print_dqm_string_from_runlist.sh Adds ShellCheck SC2086 directive.
scripts/preprocessing/prepro_rsync_db_ucla.sh Adds ShellCheck SC2086 directive.
scripts/preprocessing/prepro_rsync_data_ucla.sh Adds ShellCheck SC2086 directive.
scripts/preprocessing/prepro_pack_dl3_directories.sh Adds ShellCheck SC2086 directive.
scripts/preprocessing/prepro_move_v2dl3_files.sh Adds ShellCheck SC2086 directive; find-based file count.
scripts/preprocessing/prepro_move_preprocessed_files.sh Adds ShellCheck SC2086 directive; find-based file count.
scripts/preprocessing/prepro_check_and_clean_files.sh Adds ShellCheck SC2086 directive; find-based aux count.
scripts/preprocessing/prepare_runlist_after_dqm.sh Adds ShellCheck SC2086 directive; fixes variable name in message.
scripts/preprocessing/pack_log_files.sh Adds ShellCheck SC2086 directive.
scripts/preprocessing/pack_data_files.sh Adds ShellCheck SC2086 directive.
scripts/preprocessing/check_evndisp_mscw_processing.sh Adds ShellCheck SC2086 directive.
scripts/preprocessing/check_epochs_for_3tel_irfs.sh Adds ShellCheck SC2086 directive.
scripts/preprocessing/check_dl3_number_of_files_per_cut.sh Adds ShellCheck SC2086 directive.
scripts/preprocessing/archive_error_files.sh Adds SC2086 to disable list; $(...) for version.
scripts/IRF.trainXGBforGammaHadronSeparationTraining.sh ShellCheck fixes (`
scripts/IRF.trainXGBforAngularReconstructionBinned.sh ShellCheck fixes (`
scripts/IRF.trainTMVAforGammaHadronSeparation.sh ShellCheck fixes (`
scripts/IRF.trainTMVAforAngularReconstruction.sh ShellCheck fixes (`
scripts/IRF.selectRunsForGammaHadronSeparationTraining.sh ShellCheck fixes (SC2086 directive; arithmetic loops).
scripts/IRF.production.sh ShellCheck fixes (`
scripts/IRF.optimizeTMVAforGammaHadronSeparation.sh ShellCheck fixes (`
scripts/IRF.mscw_energy_MC.sh ShellCheck fixes (`
scripts/IRF.generate_radial_acceptance.sh ShellCheck fixes (`
scripts/IRF.generate_NOISEfiles_from_PedestalEvents.sh ShellCheck fixes ($(...) for version).
scripts/IRF.generate_lookup_table_parts.sh ShellCheck fixes (`
scripts/IRF.generate_effective_area_parts.sh ShellCheck fixes (`
scripts/IRF.generalproduction.sh Adds ShellCheck SC2086 directive.
scripts/IRF.evndisp_MC.sh ShellCheck fixes (`
scripts/IRF.dispXGB.sh ShellCheck fixes ($(date ...), $(...) submission).
scripts/IRF.compress_evndisp_MC.sh ShellCheck fixes (`
scripts/IRF.combine_lookup_table_parts.sh ShellCheck fixes (`
scripts/IRF.combine_effective_area_parts.sh ShellCheck fixes (`
scripts/helper_scripts/UTILITY.script_init.sh Adds SC2086 directive; shellcheck source annotation.
scripts/helper_scripts/UTILITY.readSubmissionCommand.sh Uses read -r; quotes redirection input file.
scripts/helper_scripts/UTILITY.condorSubmission.sh Adds ShellCheck SC2086 directive.
scripts/helper_scripts/UTILITY.check_root_file_closed.sh Uses if ! cmd; then pattern for exit status.
scripts/helper_scripts/submit_scripts_to_htcondor.sh Groups repeated echo >> file; quotes paths more consistently.
scripts/helper_scripts/SPANALYSIS.make_DST_sub.sh Adds SC2086 disable; shellcheck source annotation.
scripts/helper_scripts/SPANALYSIS.lowgainped_sub.sh Adds SC2086 disable; shellcheck source annotation.
scripts/helper_scripts/IRF.trainTMVAforGammaHadronSeparation_sub.sh Adds SC2086 disable; shellcheck source; avoids command-subst for function output.
scripts/helper_scripts/IRF.trainTMVAforAngularReconstruction_sub.sh Adds SC2086 disable; shellcheck source; read -r loop + quoting.
scripts/helper_scripts/IRF.radial_acceptance_sub.sh Adds SC2086 disable; shellcheck source annotation.
scripts/helper_scripts/IRF.optimizeTMVAforGammaHadronSeparation_sub.sh Adds SC2086 disable; shellcheck source annotation.
scripts/helper_scripts/IRF.mscw_energy_MC_sub.sh Adds SC2086 disable; shellcheck source; avoids command-subst for function output.
scripts/helper_scripts/IRF.lookup_table_parallel_sub.sh Adds SC2086 disable; uses find for file list; avoids command-subst for function output.
scripts/helper_scripts/IRF.lookup_table_combine_sub.sh Adds SC2086 disable; shellcheck source; avoids command-subst for function output.
scripts/helper_scripts/IRF.evndisp_MC_sub.sh Adds SC2086 disable; shellcheck source; avoids command-subst for function output; grep -c use.
scripts/helper_scripts/IRF.effective_area_parallel_sub.sh Adds SC2086 disable; shellcheck source; avoids command-subst for function output.
scripts/helper_scripts/IRF.effective_area_combine_sub.sh Adds SC2086 disable; shellcheck source; avoids command-subst for function output.
scripts/helper_scripts/IRF.dispXGB_sub.sh Adds ShellCheck SC2086 directive.
scripts/helper_scripts/IRF.compress_evndisp_MC_sub.sh Adds SC2086 disable; shellcheck source; grep -c use.
scripts/helper_scripts/ANALYSIS.v2dl3_sub.sh Adds SC2086 disable; $(...) for file reads; shellcheck source annotation.
scripts/helper_scripts/ANALYSIS.mscw_energy_sub.sh Adds SC2086 disable; shellcheck source; $(...) conversions; grouped appends.
scripts/helper_scripts/ANALYSIS.evndisp_sub.sh Adds SC2086 disable; shellcheck source; avoids command-subst for function output.
scripts/helper_scripts/ANALYSIS.evndisp_laser_sub.sh Adds SC2086 disable; shellcheck source annotation.
scripts/helper_scripts/ANALYSIS.dispXGB_sub.sh Adds ShellCheck SC2086 directive.
scripts/helper_scripts/ANALYSIS.anasum_sub.sh Adds SC2086 disable; shellcheck source; $(...) conversions; grouped appends.
scripts/helper_scripts/ANALYSIS.anasum_combine_sub.sh Adds SC2086 disable; shellcheck source; groups log appends.
scripts/db_scripts/query_run_list.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_write_fits_from_runlist.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_weather.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_VPM.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_update_tar_balls.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_update_old_laser_files.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_toffset.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_target.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_runinfo.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_rundqm.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_run.sh Adds ShellCheck SC2086 directive; arithmetic loop cleanups.
scripts/db_scripts/db_rawpointing.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_pack_new_directories.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_mysqldb.sh Adds ShellCheck SC2086 directive; grep -E change.
scripts/db_scripts/db_lidar.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_laserrun.sh Adds SC2086 to disable list.
scripts/db_scripts/db_L3.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_L1_TriggerInfo.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_HVsettings.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_gain.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_fir.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_FADCsettings.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_copy_old_laser_calibration.sh Adds ShellCheck SC2086 directive.
scripts/db_scripts/db_camerarotation.sh Adds ShellCheck SC2086 directive.
scripts/ANALYSIS.v2dl3.sh ShellCheck fixes ($(date ...), find instead of ls, submission command usage).
scripts/ANALYSIS.mscw_energy.sh ShellCheck fixes (`
scripts/ANALYSIS.evndisp.sh ShellCheck fixes (`
scripts/ANALYSIS.evndisp_muon.sh ShellCheck fixes (`
scripts/ANALYSIS.evndisp_laser.sh ShellCheck fixes (`
scripts/ANALYSIS.dispXGB.sh ShellCheck fixes ($(date ...), $(...) submission).
scripts/ANALYSIS.anasum.sh ShellCheck fixes (`
scripts/ANALYSIS.anasum_parallel_from_runlist.sh ShellCheck fixes (`
scripts/ANALYSIS.anasum_link_files.sh ShellCheck fixes plus minor refactors for run list reading.
scripts/ANALYSIS.anasum_combine.sh ShellCheck fixes (`
scripts/ANALYSIS.anasum_allcuts.sh Adds ShellCheck SC2086 directive.
.github/workflows/CI.yml Runs ShellCheck with --severity=info.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 103 to 105
else
ENBINS=$( cat "$RUNPAR" | grep "^* ENERGYBINEDGES" | sed -e 's/* ENERGYBINEDGES//' | sed -e 's/ /\n/g')
mapfile -t EBINARRAY <<< "$ENBINS"
Comment on lines 119 to 121
# zenith angle bins
ZEBINS=$( cat "$RUNPAR" | grep "^* ZENBINS " | sed -e 's/* ZENBINS//' | sed -e 's/ /\n/g')
mapfile -t ZEBINARRAY <<< "$ZEBINS"
Comment on lines +57 to 61
RUNS=$(cat "$RUNLIST")
NRUNS=$(cat "$RUNLIST" | wc -l )
echo "total number of runs to be linked: $NRUNS"

for RUN in "${RUNS[@]}"; do
@GernotMaier GernotMaier marked this pull request as ready for review May 31, 2026 10:40
@GernotMaier GernotMaier merged commit e6bf48e into v492-dev18-shellcheck May 31, 2026
1 check passed
@GernotMaier GernotMaier deleted the v492-dev18-shellcheck-info branch May 31, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants