From dcff026da04e0462a51b377303694a3e42fee9c9 Mon Sep 17 00:00:00 2001 From: versat Date: Mon, 4 Feb 2019 11:25:29 +0100 Subject: [PATCH] donate-cpu.py: Simplify check if line is not empty In Python an empty string returns False in a conditional check. No need to calculate lenght or compare it with an empty string. --- tools/donate-cpu.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/donate-cpu.py b/tools/donate-cpu.py index 93d163186..3b6cee5bb 100644 --- a/tools/donate-cpu.py +++ b/tools/donate-cpu.py @@ -263,11 +263,10 @@ def scanPackage(workPath, cppcheckPath, jobs): for line in stderr.split('\n'): if ': information: ' in line: information_messages += line + '\n' - else: - if len(line) > 0: - issue_messages += line + '\n' - if re.match(r'.*:[0-9]+:.*\]$', line): - count += 1 + elif line: + issue_messages += line + '\n' + if re.match(r'.*:[0-9]+:.*\]$', line): + count += 1 print('Number of issues: ' + str(count)) return count, issue_messages, information_messages, elapsedTime, options