diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..442b91c37 --- /dev/null +++ b/.clang-format @@ -0,0 +1,3 @@ +# Run manually to reformat a file: +# clang-format -i --style=file +BasedOnStyle: Google diff --git a/scripts/format_all.sh b/scripts/format_all.sh index 0e374a3cc..4834f44ef 100755 --- a/scripts/format_all.sh +++ b/scripts/format_all.sh @@ -19,6 +19,6 @@ python3 -m yapf --style=google --in-place --recursive ./tensorflow_quantum echo -e "Done! \nDoing notebook formatting..." python3 ./scripts/format_ipynb.py echo -e "Done! \nDoing C++ formatting..." -find tensorflow_quantum/ -iname *.h -o -iname *.cc | xargs clang-format -i -style=google +find tensorflow_quantum/ -iname *.h -o -iname *.cc | xargs clang-format -i echo "Done!" exit 0; diff --git a/scripts/format_check.sh b/scripts/format_check.sh index f0de918dc..9a1bf1fd4 100755 --- a/scripts/format_check.sh +++ b/scripts/format_check.sh @@ -1,12 +1,12 @@ #!/bin/bash # Copyright 2020 The TensorFlow Quantum Authors. All Rights Reserved. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -100,7 +100,7 @@ if [ $? -ne 0 ]; then fi echo "Checking C++ formatting..."; -formatting_outputs=$(find tensorflow_quantum/ -iname *.h -o -iname *.cc | xargs clang-format -style=google -output-replacements-xml); +formatting_outputs=$(find tensorflow_quantum/ -iname *.h -o -iname *.cc | xargs clang-format -output-replacements-xml); CFORMATCHECK=0 while read -r formatting_outputs; do if [ "$formatting_outputs" != "" ] && [ "$formatting_outputs" != "" ] && [ "$formatting_outputs" != "" ] && [ "$formatting_outputs" != " " ]; then