Like 'for/do' check that the while/until operator are on
the same line with the do.
Fixes some pep8 error along the way.
Change-Id: I440afe60691263365bf35310bf4212d94f30c339
... | ... |
@@ -47,7 +47,7 @@ IGNORE = None |
47 | 47 |
def register_ignores(ignores): |
48 | 48 |
global IGNORE |
49 | 49 |
if ignores: |
50 |
- IGNORE='^(' + '|'.join(ignores.split(',')) + ')' |
|
50 |
+ IGNORE = '^(' + '|'.join(ignores.split(',')) + ')' |
|
51 | 51 |
|
52 | 52 |
|
53 | 53 |
def should_ignore(error): |
... | ... |
@@ -64,11 +64,15 @@ def print_error(error, line): |
64 | 64 |
def not_continuation(line): |
65 | 65 |
return not re.search('\\\\$', line) |
66 | 66 |
|
67 |
+ |
|
67 | 68 |
def check_for_do(line): |
68 | 69 |
if not_continuation(line): |
69 |
- if re.search('^\s*for ', line): |
|
70 |
+ match = re.match('^\s*(for|while|until)\s', line) |
|
71 |
+ if match: |
|
72 |
+ operator = match.group(1).strip() |
|
70 | 73 |
if not re.search(';\s*do(\b|$)', line): |
71 |
- print_error('E010: Do not on same line as for', line) |
|
74 |
+ print_error('E010: Do not on same line as %s' % operator, |
|
75 |
+ line) |
|
72 | 76 |
|
73 | 77 |
|
74 | 78 |
def check_if_then(line): |
... | ... |
@@ -191,8 +191,7 @@ function wait_for_VM_to_halt() { |
191 | 191 |
domid=$(xe vm-list name-label="$GUEST_NAME" params=dom-id minimal=true) |
192 | 192 |
port=$(xenstore-read /local/domain/$domid/console/vnc-port) |
193 | 193 |
echo "vncviewer -via root@$mgmt_ip localhost:${port:2}" |
194 |
- while true |
|
195 |
- do |
|
194 |
+ while true; do |
|
196 | 195 |
state=$(xe_min vm-list name-label="$GUEST_NAME" power-state=halted) |
197 | 196 |
if [ -n "$state" ]; then |
198 | 197 |
break |