Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Run manually to reformat a file:
# clang-format -i --style=file <file>
BasedOnStyle: Google
2 changes: 1 addition & 1 deletion scripts/format_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
mhucka marked this conversation as resolved.
echo "Done!"
exit 0;
8 changes: 4 additions & 4 deletions scripts/format_check.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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);
Comment thread
mhucka marked this conversation as resolved.
CFORMATCHECK=0
while read -r formatting_outputs; do
if [ "$formatting_outputs" != "<?xml version='1.0'?>" ] && [ "$formatting_outputs" != "<replacements xml:space='preserve' incomplete_format='false'>" ] && [ "$formatting_outputs" != "</replacements>" ] && [ "$formatting_outputs" != "<replacement offset='4290' length='9'> </replacement>" ]; then
Expand Down
Loading