Brush up task file conversion scripts

Modernize them by using f-strings and print out the issue count.
Make flake2tasks.py include the error number in the warning text.

Change-Id: I2d736c27dd3b2356e2b0d0d20f95112e7c37d3f9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
This commit is contained in:
Friedemann Kleint
2024-01-16 14:31:13 +01:00
parent 73475480f7
commit b9cce1a0ba
2 changed files with 11 additions and 6 deletions

View File

@@ -14,7 +14,8 @@ import sys
import re
if __name__ == '__main__':
pattern = re.compile(r'^([^:]+):(\d+):\d+: E\d+ (.*)$')
pattern = re.compile(r'^([^:]+):(\d+):\d+: (.*)$')
n = 0
while True:
line = sys.stdin.readline().rstrip()
if not line:
@@ -24,5 +25,7 @@ if __name__ == '__main__':
file_name = match.group(1).replace('\\', '/')
line_number = match.group(2)
text = match.group(3)
output = "{}\t{}\twarn\t{}".format(file_name, line_number, text)
print(output)
print(f"{file_name}\t{line_number}\twarn\t{text}")
n += 1
if n:
print(f"{n} issue(s) found.", file=sys.stderr)

View File

@@ -16,6 +16,7 @@ if __name__ == '__main__':
# qt.shiboken: (<module>) <file>:<line>:[<column>:] text
# file might be c:\ on Windows
pattern = re.compile(r'^qt\.shiboken: \(([^)]+)\) (..[^:]+):(\d+):(?:\d+:)? (.*)$')
n = 0
while True:
line = sys.stdin.readline()
if not line:
@@ -26,6 +27,7 @@ if __name__ == '__main__':
file_name = match.group(2).replace('\\', '/')
line_number = match.group(3)
text = match.group(4)
output = "{}\t{}\twarn\t{}: {}".format(file_name, line_number,
module, text)
print(output)
print(f"{file_name}\t{line_number}\twarn\t{module}: {text}")
n += 1
if n:
print(f"{n} issue(s) found.", file=sys.stderr)