diff options
author | Jacob Walls <jacobtylerwalls@gmail.com> | 2022-05-31 10:19:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 10:19:03 -0400 |
commit | 731df04892469ae04fa7f66ca0648578cebd87e5 (patch) | |
tree | 66730e410d5b2f7c83e6b5565a46265818240e93 | |
parent | 90b6d1adeed4e4eb8e73bc6b0a03f7a497f242ac (diff) | |
download | pylint-git-731df04892469ae04fa7f66ca0648578cebd87e5.tar.gz |
Filter out astroid errors from the bot comment (#6773)
-rw-r--r-- | tests/primer/primer_tool.py | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/tests/primer/primer_tool.py b/tests/primer/primer_tool.py index 2e921f8a2..7748009ba 100644 --- a/tests/primer/primer_tool.py +++ b/tests/primer/primer_tool.py @@ -184,44 +184,37 @@ class Primer: # Create comment for new messages count = 1 - fatal_count = 1 - new_non_fatal_messages = "" - new_fatal_messages = "" + astroid_errors = 0 + new_non_astroid_messages = "" if new_messages: print("Now emitted:") for message in new_messages: - if message["type"] == "fatal": - filepath = str(message["path"]).replace( - str(package_data.clone_directory), "" - ) - new_fatal_messages += ( - f"{fatal_count}) {message['symbol']}:\n*{message['message']}*\n" - "**Please check your changes on the following file**:\n" - f"{package_data.url}/blob/{package_data.branch}{filepath}#L{message['line']}\n" - ) - print(message) - fatal_count += 1 + filepath = str(message["path"]).replace( + str(package_data.clone_directory), "" + ) + # Existing astroid errors may still show up as "new" because the timestamp + # in the message is slightly different. + if message["symbol"] == "astroid-error": + astroid_errors += 1 else: - filepath = str(message["path"]).replace( - str(package_data.clone_directory), "" - ) - new_non_fatal_messages += ( + new_non_astroid_messages += ( f"{count}) {message['symbol']}:\n*{message['message']}*\n" f"{package_data.url}/blob/{package_data.branch}{filepath}#L{message['line']}\n" ) print(message) count += 1 - if new_fatal_messages: + if astroid_errors: comment += ( - "The following **fatal messages** are now emitted: 💣💥\n\n<details>\n\n" - + new_fatal_messages - + "\n</details>\n\n" + f"{astroid_errors} error(s) were found stemming from the `astroid` library. " + "This is unlikely to have been caused by your changes. " + "A GitHub Actions warning links directly to the crash report template. " + "Please open an issue against `astroid` if one does not exist already. \n\n" ) - if new_non_fatal_messages: + if new_non_astroid_messages: comment += ( "The following messages are now emitted:\n\n<details>\n\n" - + new_non_fatal_messages + + new_non_astroid_messages + "\n</details>\n\n" ) |