Skip to content

Commit

Permalink
Update format.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
leventeBajczi authored Jul 10, 2023
1 parent 1f4d352 commit 7356af9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ filemask="$1"
additional_options="$2"
settings_file="$3"

tempdir=$(mktemp)
/opt/idea/bin/format.sh -m "$filemask" $additional_options -r -s /github/workspace/"$settings_file" /github/workspace/ 2>&1 | tee -a $tempdir/output
newly_formatted=$(cat $tempdir/output | grep "OK$" | wc -l)
formatted_well=$(cat $tempdir/output | grep "Formatted well$" | wc -l)
needs_reformatting=$(cat $tempdir/output | grep "Needs reformatting$" | wc -l)
tempfile=$(mktemp)
/opt/idea/bin/format.sh -m "$filemask" $additional_options -r -s /github/workspace/"$settings_file" /github/workspace/ | tee -a $tempfile
newly_formatted=$(cat $tempfile | grep "OK$" | wc -l)
formatted_well=$(cat $tempfile | grep "Formatted well$" | wc -l)
needs_reformatting=$(cat $tempfile | grep "Needs reformatting$" | wc -l)
echo "Formatted ($newly_formatted)":
cat $tempdir/output | grep -o -P '(?<=Formatting ).*(?=...OK)'
cat $tempfile | grep -o -P '(?<=Formatting ).*(?=...OK)'
echo
echo "==================="
echo
echo "Formatted well ($formatted_well)":
cat $tempdir/output | grep -o -P '(?<=Checking ).*(?=...Formatted well)'
cat $tempfile | grep -o -P '(?<=Checking ).*(?=...Formatted well)'
echo
echo "==================="
echo
echo "Needs reformatting ($needs_reformatting)":
! cat $tempdir/output | grep -o -P '(?<=Checking ).*(?=...Needs reformatting)'
! cat $tempfile | grep -o -P '(?<=Checking ).*(?=...Needs reformatting)'

0 comments on commit 7356af9

Please sign in to comment.