Skip to content

Commit 10e09bc

Browse files
committed
add override support to qgisstyle
include pep8 call in indentation run for python code
1 parent 47488f2 commit 10e09bc

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

scripts/astyle.sh

+12-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,19 @@ if [ -z "$ASTYLE" ]; then
2929
fi
3030

3131
if ! type -p flip >/dev/null; then
32+
echo "flip not found" >&2
3233
flip() {
3334
:
3435
}
3536
fi
3637

38+
if ! type -p pep8 >/dev/null; then
39+
echo "pep8 not found" >&2
40+
pep8() {
41+
:
42+
}
43+
fi
44+
3745
set -e
3846

3947
export ARTISTIC_STYLE_OPTIONS="\
@@ -60,7 +68,7 @@ $ARTISTIC_STYLE_OPTIONS \
6068

6169
for f in "$@"; do
6270
case "$f" in
63-
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/*)
71+
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)
6472
echo -ne "$f skipped $elcr"
6573
continue
6674
;;
@@ -73,11 +81,11 @@ for f in "$@"; do
7381
cmd=:
7482
;;
7583

76-
python/ext-libs/*)
77-
cmd=:
84+
*.py)
85+
cmd="pep8 --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701"
7886
;;
7987

80-
*.py|*.sip)
88+
*.sip)
8189
cmd="perl -i.prepare -pe 's/[\r\t ]+$//;'"
8290
;;
8391

src/astyle/ASResource.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const string ASResource::AS_CATCH = string("catch");
5757
const string ASResource::AS_FINALLY = string("finally");
5858
const string ASResource::AS_THROWS = string("throws");
5959
const string ASResource::AS_CONST = string("const");
60+
const string ASResource::AS_OVERRIDE = string("override");
6061

6162
const string ASResource::AS_ASM = string("asm");
6263

@@ -211,6 +212,7 @@ void ASResource::buildHeaders(vector<const string*> &headers, int fileType, bool
211212
headers.push_back(&AS_STATIC);
212213
headers.push_back(&AS_EXTERN);
213214
headers.push_back(&AS_TEMPLATE);
215+
headers.push_back(&AS_OVERRIDE);
214216
}
215217

216218
if (fileType == JAVA_TYPE)
@@ -282,6 +284,7 @@ void ASResource::buildNonParenHeaders(vector<const string*> &nonParenHeaders, in
282284
nonParenHeaders.push_back(&AS_STATIC);
283285
nonParenHeaders.push_back(&AS_EXTERN);
284286
nonParenHeaders.push_back(&AS_TEMPLATE);
287+
nonParenHeaders.push_back(&AS_OVERRIDE);
285288
}
286289

287290
if (fileType == JAVA_TYPE)

src/astyle/astyle.h

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class ASResource
118118
static const string AS_CLASS, AS_STRUCT, AS_UNION, AS_INTERFACE, AS_NAMESPACE, AS_EXTERN;
119119
static const string AS_STATIC;
120120
static const string AS_CONST;
121+
static const string AS_OVERRIDE;
121122
static const string AS_SYNCHRONIZED;
122123
static const string AS_OPERATOR, AS_TEMPLATE;
123124
static const string AS_OPEN_BRACKET, AS_CLOSE_BRACKET;

0 commit comments

Comments
 (0)