cea-hpc / modules

Environment Modules: provides dynamic modification of a user's environment
http://modules.sourceforge.net/
GNU General Public License v2.0
695 stars 109 forks source link

Fix ShellCheck reports - Part 1 #471

Closed lzaoral closed 2 years ago

lzaoral commented 2 years ago

This PR is the first one in the series to address all ShellCheck reports in this project. See the commit messages for additional information.

Related: #470

lzaoral commented 2 years ago

Please ignore the Differential ShellCheck failure. Due to 0796a1a, ShellCheck now recognizes additional files as shell scripts and will report all detected problems in such files as new.

lzaoral commented 2 years ago

I've dropped df8d81a since it completely broke testsuite/bin/install_test_sh and a few quoted shell variables that shouldn't be quoted after all. Hopefully, it's enough to make the CI green again.

xdelaruelle commented 2 years ago

This is great, thanks a lot for this contribution.

Maybe some shellcheck ignore directive could be added in c9e78c8, to mention that _mlre variable need some expansion. But maybe you have other plans with PR part2.

Somehow 50/140 test from modules testsuite fails on some CI environment.

xdelaruelle commented 2 years ago

I have fixed SC2048 commit to correct testsuite/cmd.exe script that needs word expansion from string to work as expected to perform tests.

I have added shellcheck directive in init/*.in files for SC2086, as word splitting is expected on _mlre variable.

I have merged these modifications in the initial "fix SCXXXX" commit.

On my side, I have added to lint testsuite to test for the moment sh, bash, bash and tcl scripts against a linter. I have rebased the branch over these new additions on the master branch.

lzaoral commented 2 years ago

Wow, thank you @xdelaruelle! Unfortunately, I was offline yesterday so hadn't the chance to reply sooner.