#!/bin/sh
###set -e
trap "exit" INT
function scala_compile {
  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2> /dev/null 1> /dev/null) 
}
files=${1:-assignment2019scala-*/Part10}
name="bf.scala"
for sd in $files; do
    scalafix -r DisableSyntax --settings.DisableSyntax.noVars=true --settings.DisableSyntax.noReturns=true --settings.DisableSyntax.noWhileLoops=true $sd/$name 2> /dev/null 1> /dev/null
   ts=$(( $? )) 
   if [ $ts -ne 0 ]
   then
     echo $sd  
     echo $ts
   else
       if (scala_compile $sd/$name)
       then	  
         ts=$(( 0 ))
       else
         echo $sd  
         echo $ts  
       fi	   
   fi  
done