Skip to content

Commit

Permalink
chore: exclude firestore and spanner samples from formatting (#1295)
Browse files Browse the repository at this point in the history
* chore: exclude firestore and spanner samples from formatting

* chore: remove comment

* chore: create a temporary file

* chore: fix command
  • Loading branch information
Neenu1995 committed Dec 2, 2021
1 parent 6b5cee7 commit 1a34456
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion docker/owlbot/java/bin/format_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,22 @@ set -e

# Find all the java files relative to the current directory and format them
# using google-java-format
find . -name '*.java' | xargs java -jar /owlbot/google-java-format.jar --replace
list="$(find . -name '*.java' )"
tmpfile=$(mktemp)

for file in $list;
do
if [[ "$file" =~ ".*/samples/snippets/src/main/java/com/example/firestore/Quickstart.java" ]];
then
echo "File skipped formatting: $file"
elif [[ "$file" =~ ".*/samples/snippets/src/main/java/com/example/spanner/.*.java" ]];
then
echo "File skipped formatting: $file"
else
echo $file >> $tmpfile
fi
done

cat $tmpfile | xargs java -jar /owlbot/google-java-format.jar --replace

rm $tmpfile

0 comments on commit 1a34456

Please sign in to comment.