Skip to content

Commit

Permalink
Minor improvement to the civ_report_analyzer.py tool.
Browse files Browse the repository at this point in the history
  • Loading branch information
narmaku committed Jun 26, 2024
1 parent f2cf471 commit 04bb69f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main/civ_report_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def get_analysis_as_cli(summary, analysis):


def __parse_error_message(error_message):
max_lenght = 1000

regex_error_generic = re.compile(r'(?:(?:AssertionError|Failed): (.*))')
regex_error_command = re.compile(
r"Unexpected exit code \d+ for CommandResult\(command=b?(?P<command>['|\"]?.*['|\"]?), "
Expand Down Expand Up @@ -127,6 +129,11 @@ def __parse_error_message(error_message):

extracted_message = '\n\n'.join(composed_error_message)

diff = len(extracted_message) - max_lenght
if diff > 0:
chunk_size = max_lenght // 2
extracted_message = (extracted_message[0:chunk_size] + ' [<truncated>] ' + extracted_message[-chunk_size:-1])

return extracted_message


Expand Down

0 comments on commit 04bb69f

Please sign in to comment.