25
25
26
26
PackageMessages = Dict [str , List [Dict [str , Union [str , int ]]]]
27
27
28
+ GITHUB_CRASH_TEMPLATE_LOCATION = "/home/runner/.cache"
29
+ CRASH_TEMPLATE_INTRO = "There is a pre-filled template"
30
+
28
31
29
32
class Primer :
30
33
"""Main class to handle priming of packages."""
@@ -128,6 +131,20 @@ def _handle_run_command(self) -> None:
128
131
packages [package ] = output
129
132
print (f"Successfully primed { package } ." )
130
133
134
+ astroid_errors = []
135
+ other_fatal_msgs = []
136
+ for msg in chain .from_iterable (packages .values ()):
137
+ if msg ["type" ] == "fatal" :
138
+ # Remove the crash template location if we're running on GitHub.
139
+ # We were falsely getting "new" errors when the timestamp changed.
140
+ assert isinstance (msg ["message" ], str )
141
+ if GITHUB_CRASH_TEMPLATE_LOCATION in msg ["message" ]:
142
+ msg ["message" ] = msg ["message" ].rsplit (CRASH_TEMPLATE_INTRO )[0 ]
143
+ if msg ["symbol" ] == "astroid-error" :
144
+ astroid_errors .append (msg )
145
+ else :
146
+ other_fatal_msgs .append (msg )
147
+
131
148
with open (
132
149
PRIMER_DIRECTORY
133
150
/ f"output_{ '.' .join (str (i ) for i in sys .version_info [:3 ])} _{ self .config .type } .txt" ,
@@ -141,13 +158,6 @@ def _handle_run_command(self) -> None:
141
158
# This is to avoid introducing a dependency on bleeding-edge astroid
142
159
# for pylint CI pipelines generally, even though we want to use astroid main
143
160
# for the purpose of diffing emitted messages and generating PR comments.
144
- messages = list (chain .from_iterable (packages .values ()))
145
- astroid_errors = [msg for msg in messages if msg ["symbol" ] == "astroid-error" ]
146
- other_fatal_msgs = [
147
- msg
148
- for msg in messages
149
- if msg ["type" ] == "fatal" and msg ["symbol" ] != "astroid-error"
150
- ]
151
161
if astroid_errors :
152
162
warnings .warn (f"Fatal errors traced to astroid: { astroid_errors } " )
153
163
assert not other_fatal_msgs , other_fatal_msgs
0 commit comments