Using version newer than 3.9 results in a lot of format changes.
As user may want to use newer clang-format version for different
projects, script has been changed to use clang-format-3.9 executable.
[Verification] No change in C++ formatting
Change-Id: I4f569644549db8104bb39efc6bc1eca23ac6bbd6
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
<p><code>cpplint</code> is used to validate C++ and <code>eslint</code> for JavaScript files.</p>
<p><strong>Currently, the JavaScript validator and formatter seems to be a little buggy,
thus it is not recommended to use.</strong></p>
-<p>The developer needs to have <code>python</code>, <code>node.js</code>, <code>eslint</code>, <code>Closure Linter</code> and <code>clang-format</code> installed.</p>
-<p>It is worth to make life easier by creating symbolic link to <code>clang-format</code>.</p>
-<pre><code class="lang-sh">sudo ln -s /usr/bin/clang-format-<clang format version> /usr/bin/clang-format
-</code></pre>
+<p>The developer needs to have <code>python</code>, <code>node.js</code>, <code>eslint</code>, <code>Closure Linter</code> and <code>clang-format-3.9</code> installed.</p>
<p>For convenience, in the root of the project links were provided for easier access:</p>
<ul>
<li><code>code_format -> tools/codestyle/code_formatter.sh</code></li>
**Currently, the JavaScript validator and formatter seems to be a little buggy,
thus it is not recommended to use.**
-The developer needs to have ``python``, ``node.js``, ``eslint``, ``Closure Linter`` and ``clang-format`` installed.
-
-It is worth to make life easier by creating symbolic link to ``clang-format``.
-```sh
-sudo ln -s /usr/bin/clang-format-<clang format version> /usr/bin/clang-format
-```
+The developer needs to have ``python``, ``node.js``, ``eslint``, ``Closure Linter`` and ``clang-format-3.9`` installed.
For convenience, in the root of the project links were provided for easier access:
- ``code_format -> tools/codestyle/code_formatter.sh``
SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
# https://clangformat.com/
-if [ ! "$(command -v clang-format)" ]; then
+if [ ! "$(command -v clang-format-3.9)" ]; then
echo >&2 "clang-format is required, but it's not installed";
echo "-------------------------------------------------------------------------------------";
- echo "To install clang-format on Debian/Ubuntu, execute the following commands."
+ echo "To install clang-format on Debian/Ubuntu, execute the following command:"
echo " sudo apt-get install clang-format-3.9"
- echo " sudo ln -s /usr/bin/clang-format-3.9 /usr/bin/clang-format"
echo "-------------------------------------------------------------------------------------";
exit 1;
fi
formatC++() {
printf "."
find -- "$1" -type f \( -name '*.cc' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) | \
- grep -v 'src/google' | xargs -n1 --no-run-if-empty clang-format -i -style="$config"
+ grep -v 'src/google' | xargs -n1 --no-run-if-empty clang-format-3.9 -i -style="$config"
}
checkUpdatedFiles() {
if [ "${f: -3}" == ".cc" ] || [ "${f: -4}" == ".cpp" ] || [ "${f: -2}" == ".h" ] || \
[ "${f: -4}" == ".hpp" ]; then
printf '.'
- clang-format -i -style="$config" "$f";
+ clang-format-3.9 -i -style="$config" "$f";
fi
done < <(git diff-index -z --name-only --diff-filter=AM HEAD --)
}