diff --git a/jenkins_pipelines/manager_prs/tests_files/rubocop.sh b/jenkins_pipelines/manager_prs/tests_files/rubocop.sh index 9a8818147..84408f9f0 100755 --- a/jenkins_pipelines/manager_prs/tests_files/rubocop.sh +++ b/jenkins_pipelines/manager_prs/tests_files/rubocop.sh @@ -1,6 +1,17 @@ #! /bin/bash echo "running rubocop on step files" -rubocop.ruby2.5 -v -cd testsuite -rubocop.ruby2.5 features/* +rubocop_file="testsuite/.rubocop.yml" +if [[ -f "$rubocop_file" ]]; then + # Extract the Ruby version from the file + ruby_version=$(grep "TargetRubyVersion:" "$rubocop_file" | awk '{print $2}') + if [[ -n "$ruby_version" ]]; then + rubocop.ruby"$ruby_version" -v + cd testsuite + rubocop.ruby"$ruby_version" features/* + else + echo "No TargetRubyVersion found in $rubocop_file." + fi +else + echo "File $rubocop_file does not exist." +fi