diff --git a/scripts/astyle.sh b/scripts/astyle.sh index 8128098c8e3..d3eb327ad6e 100755 --- a/scripts/astyle.sh +++ b/scripts/astyle.sh @@ -29,11 +29,19 @@ if [ -z "$ASTYLE" ]; then fi if ! type -p flip >/dev/null; then + echo "flip not found" >&2 flip() { : } fi +if ! type -p pep8 >/dev/null; then + echo "pep8 not found" >&2 + pep8() { + : + } +fi + set -e export ARTISTIC_STYLE_OPTIONS="\ @@ -60,7 +68,7 @@ $ARTISTIC_STYLE_OPTIONS \ for f in "$@"; do case "$f" in - src/app/gps/qwtpolar-*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/ext-libs/*|src/providers/spatialite/qspatialite/*|src/plugins/dxf2shp_converter/dxflib/src/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*) + src/app/gps/qwtpolar-*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/ext-libs/*|src/providers/spatialite/qspatialite/*|src/plugins/dxf2shp_converter/dxflib/src/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*|python/ext-libs/*|*/ui_*.py) echo -ne "$f skipped $elcr" continue ;; @@ -73,11 +81,11 @@ for f in "$@"; do cmd=: ;; - python/ext-libs/*) - cmd=: + *.py) + cmd="pep8 --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701" ;; - *.py|*.sip) + *.sip) cmd="perl -i.prepare -pe 's/[\r\t ]+$//;'" ;; diff --git a/src/astyle/ASResource.cpp b/src/astyle/ASResource.cpp index 60a2ade1d66..d30bfb273c3 100644 --- a/src/astyle/ASResource.cpp +++ b/src/astyle/ASResource.cpp @@ -57,6 +57,7 @@ const string ASResource::AS_CATCH = string("catch"); const string ASResource::AS_FINALLY = string("finally"); const string ASResource::AS_THROWS = string("throws"); const string ASResource::AS_CONST = string("const"); +const string ASResource::AS_OVERRIDE = string("override"); const string ASResource::AS_ASM = string("asm"); @@ -211,6 +212,7 @@ void ASResource::buildHeaders(vector &headers, int fileType, bool headers.push_back(&AS_STATIC); headers.push_back(&AS_EXTERN); headers.push_back(&AS_TEMPLATE); + headers.push_back(&AS_OVERRIDE); } if (fileType == JAVA_TYPE) @@ -282,6 +284,7 @@ void ASResource::buildNonParenHeaders(vector &nonParenHeaders, in nonParenHeaders.push_back(&AS_STATIC); nonParenHeaders.push_back(&AS_EXTERN); nonParenHeaders.push_back(&AS_TEMPLATE); + nonParenHeaders.push_back(&AS_OVERRIDE); } if (fileType == JAVA_TYPE) diff --git a/src/astyle/astyle.h b/src/astyle/astyle.h index 0f3b6148a87..c86962b48cc 100644 --- a/src/astyle/astyle.h +++ b/src/astyle/astyle.h @@ -118,6 +118,7 @@ class ASResource static const string AS_CLASS, AS_STRUCT, AS_UNION, AS_INTERFACE, AS_NAMESPACE, AS_EXTERN; static const string AS_STATIC; static const string AS_CONST; + static const string AS_OVERRIDE; static const string AS_SYNCHRONIZED; static const string AS_OPERATOR, AS_TEMPLATE; static const string AS_OPEN_BRACKET, AS_CLOSE_BRACKET;