@@ -58,7 +58,7 @@ function set_defaults() {
5858 RUN_RUBOCOP=1
5959 else
6060 RUN_RUBOCOP=0
61- fi ;
61+ fi
6262
6363 if [ -e .spell.yml ]; then
6464 RUN_CHECK_SPELLING=1
@@ -126,6 +126,7 @@ function exclude() {
126126 echo " ERROR: Unknown step: '$1 '"
127127 echo " Known steps: $ALL_STEPS "
128128 exit 1
129+ ;;
129130 esac
130131 EXCLUDE_USED=1
131132}
@@ -168,6 +169,7 @@ function run_only() {
168169 echo " ERROR: Unknown step: '$1 '"
169170 echo " Known steps: $ALL_STEPS "
170171 exit 1
172+ ;;
171173 esac
172174 RUN_ONLY_USED=1
173175}
@@ -188,7 +190,17 @@ function dump_settings() {
188190function set_rubocop_version() {
189191 # here we need to set path exactly as update-alternatives needs, so find proper path from its output
190192 RUBOCOP_PATH=$( update-alternatives --display rubocop | sed " /^[^[:space:]]\+$1 " ' /!d;s/^\([^[:space:]]\+\).*$/\1/' )
191- update-alternatives --set rubocop " $RUBOCOP_PATH "
193+ if [ -n " $RUBOCOP_PATH " ]; then
194+ update-alternatives --set rubocop " $RUBOCOP_PATH "
195+ else
196+ RUBOCOP_PATH=$( alts -l rubocop | grep " Target:" | sed " s/^.*Target:\s*\(\S.*\)$/\1/" | grep " $1 " )
197+ if [ -n " $RUBOCOP_PATH " ]; then
198+ alts -s -n rubocop " $RUBOCOP_PATH "
199+ else
200+ echo " ERROR: Cannot set the default Rubocop version to $1 "
201+ exit 1
202+ fi
203+ fi
192204}
193205
194206# run parallel rubocop if it is available,
@@ -212,11 +224,11 @@ function check_perl() {
212224 # Perl allows checking the syntax only for one file at once, we need to use -n1
213225 # xargs option, to speed it up run the checks in parallel (-P option).
214226 # If you need to specify an additional search path use the PERL5LIB environment variable.
215- find . -type f -name ' *.p[ml]' -print0 \
216- | xargs -0 -P" $( nproc) " -n1 perl -I src/modules -I /usr/share/YaST2/modules -w -c
227+ find . -type f -name ' *.p[ml]' -print0 |
228+ xargs -0 -P" $( nproc) " -n1 perl -I src/modules -I /usr/share/YaST2/modules -w -c
217229}
218230
219- # initializa the defaults and parse the command line options
231+ # initialize the defaults and parse the command line options
220232
221233set_defaults
222234
0 commit comments