From 1029762e72216f172922e903d3faf8e4022e0c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Thu, 11 May 2023 14:02:13 +0200 Subject: [PATCH] [tools] Try to fix bloat check when comment has empty cell (#26479) The bloat check has been failing for months now because gh_report.py script seems to assume that the first row in a comment to the analyzed PR has no empty cells, and for the cc32xx platform, which happens to finish the build as the first one, a row with a blank section name is added. I don't know what is the reason of the blank section, but the script should not give up just because of one invalid entry as we miss important code size increase warnings. Also, replace deprecated DataFrame.append with concat(). --- scripts/tools/memory/gh_report.py | 3 ++- scripts/tools/memory/memdf/util/markdown.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/tools/memory/gh_report.py b/scripts/tools/memory/gh_report.py index 0e949134b1f5db..c35c3e53840be4 100755 --- a/scripts/tools/memory/gh_report.py +++ b/scripts/tools/memory/gh_report.py @@ -375,7 +375,8 @@ def merge(df: pd.DataFrame, comment) -> pd.DataFrame: cols, rows = memdf.util.markdown.read_hierified(body) break logging.debug('REC: read %d rows', len(rows)) - df = df.append(pd.DataFrame(data=rows, columns=cols).astype(df.dtypes)) + df = pd.concat([df, pd.DataFrame(data=rows, columns=cols).astype(df.dtypes)], + ignore_index=True) return df.sort_values( by=['platform', 'target', 'config', 'section']).drop_duplicates() diff --git a/scripts/tools/memory/memdf/util/markdown.py b/scripts/tools/memory/memdf/util/markdown.py index 52aea03e86db91..d738059decec8f 100644 --- a/scripts/tools/memory/memdf/util/markdown.py +++ b/scripts/tools/memory/memdf/util/markdown.py @@ -34,7 +34,7 @@ def read_hierified(f): for i in range(0, len(header)): column = columns[i + 1].strip() if not column: - column = rows[-1][i] + column = rows[-1][i] if rows else '(blank)' row.append(column) rows.append(tuple(row))