Skip to content

Commit

Permalink
Improove check_style.sh script to support fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
LuxoftAKutsan committed Jul 7, 2016
1 parent 0ed1efd commit 42105e7
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tools/infrastructure/check_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

FILE_NAMES=$(find src -name \*.h -print -o -name \*.cpp -print -o -name \*.cc -print | grep -v 3rd_party)
for FILE_NAME in $FILE_NAMES
do
clang-format-3.6 -style=file $FILE_NAME | diff $FILE_NAME -
done


check_style() {
clang-format-3.6 -style=file $1 | diff $1 -
}

fix_style() {
clang-format-3.6 -style=file -i $1
}

if [ "$1" = "--fix" ]
then
for FILE_NAME in $FILE_NAMES; do fix_style $FILE_NAME; done
else
for FILE_NAME in $FILE_NAMES; do check_style $FILE_NAME; done
fi

0 comments on commit 42105e7

Please sign in to comment.