Skip to content

Commit

Permalink
Also format *.pro files with dev/format_code.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ubruhin committed Dec 9, 2018
1 parent 6374f44 commit 7bdf8fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions dev/clang-format/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUN apt-get -q update \
&& apt-get -qy install \
clang-format-6.0 \
git \
python \
&& apt-get clean

RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-6.0 50
11 changes: 9 additions & 2 deletions dev/format_code.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -eo pipefail

# Formats files according our coding style with clang-format.
# Formats files according our coding style with clang-format. And if Python is
# available, *.pro project files will be sorted with sort_qmake_file_entries.py.
#
# Usage:
# - Make sure the executables "clang-format" and "git" are available in PATH.
Expand All @@ -26,9 +27,10 @@ done

echo "Formatting files with clang-format..."

REPO_ROOT=$(git rev-parse --show-toplevel)

if [ "$DOCKER" == "--docker" ]; then
DOCKER_IMAGE=librepcb/clang-format:6
REPO_ROOT=$(git rev-parse --show-toplevel)

if [ "$(docker images -q $DOCKER_IMAGE | wc -l)" == "0" ]; then
echo "Building clang-format container..."
Expand Down Expand Up @@ -77,3 +79,8 @@ do
done

echo "Finished: $COUNTER files modified."

# Also run sort_qmake_file_entries.py if Python is available
if [ -x "$(command -v python)" ]; then
python "$REPO_ROOT/dev/sort_qmake_file_entries.py"
fi

0 comments on commit 7bdf8fd

Please sign in to comment.