tests: static checker: Create setup function

Move some of the common code into a setup function.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt
2024-03-11 13:28:41 +00:00
parent 1aec4f737a
commit 4af4a8ad2b

View File

@@ -330,8 +330,6 @@ static_check_go_arch_specific()
# Install yamllint in the different Linux distributions # Install yamllint in the different Linux distributions
install_yamllint() install_yamllint()
{ {
source /etc/os-release || source /usr/lib/os-release
package="yamllint" package="yamllint"
case "$ID" in case "$ID" in
@@ -1399,9 +1397,16 @@ run_or_list_check_function()
eval "$func" eval "$func"
} }
setup()
{
source /etc/os-release || source /usr/lib/os-release
trap remove_tmp_files EXIT
}
main() main()
{ {
trap remove_tmp_files EXIT setup
local long_option_names="${!long_options[@]}" local long_option_names="${!long_options[@]}"