1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00
falkonOfficial/scripts/coding_style.sh
nowrep 6874df57d7 [Coding Style] Edited coding style (use linux style brackets)
Linux style brackets are now used also for source files.
One line blocks can now be without brackets.

Example:

if (test)
    foo();

Multi-line if statements are now written with conditionals (||, &&, ...)
at the end of line. The last line of if body does not ends with closing
bracket, instead the closing bracket is written on separate line.
One line blocks in multi-line if statements should not be without brackets.

Example:

if (test ||
    test2 &&
    test3
   ) {
    foo();
}

[ci skip]
2014-04-05 14:53:45 +02:00

36 lines
816 B
Bash
Executable File

#!/bin/bash
#
# Requirements:
# astyle > =2.02 (patched with foreach support)
# normalize (Qt tool to normalize all signal/slots format)
#
OPTIONS="--indent=spaces=4 --style=linux
--pad-oper --unpad-paren --pad-header --convert-tabs
--indent-preprocessor --break-closing-brackets
--align-pointer=type --align-reference=name
--suffix=none --formatted"
function format_sources {
astyle $OPTIONS \
`find -type f \( -name '*.cpp' -not -name 'moc_*.cpp' \)`
}
function format_headers {
astyle $OPTIONS --keep-one-line-statements --keep-one-line-blocks \
`find -type f -name '*.h'`
}
cd ../src
echo "Running astyle for *.cpp ..."
format_sources
echo "Running astyle for *.h ..."
format_headers
echo "Running normalize ..."
normalize --modify .
exit 0