Skip to content

Instantly share code, notes, and snippets.

@adamvr
Created April 11, 2012 06:53
Show Gist options
  • Select an option

  • Save adamvr/2357437 to your computer and use it in GitHub Desktop.

Select an option

Save adamvr/2357437 to your computer and use it in GitHub Desktop.
j=$1
echo "Marking $j"
# add line numbers and line-length header, outputs
# to the new '$j.annotated.txt' file
_lines $j
# add tab count footer
grep -cP '\t' $j | gawk '{ if ($1 > 0) print "[INDENTATION] File contained " $1 " tab characters. Indentation should be four spaces per indentation level.\n Each tab was converted to four spaces for style marking. This counts as one style violation." }' >> $j.annotated.txt
# remove spaces from annotated source file
cat $j.annotated.txt | sed 's/\t/ /g' > temp
mv temp $j.annotated.txt
# remove spaces from source to be marked
cat $j | sed 's/\t/ /g' > $j.spaces.c
# run actual style marking
vera++ -rule csse2310 $j.spaces.c 2> $j.veraout.txt
# merge the errors listed back into a new file $j.errors.c
_merge $j.annotated.txt $j.veraout.txt > $j.errors.c
# clean up temp files
rm $j.annotated.txt $j.spaces.c $j.veraout.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment