|
1 | 1 | import logging
|
| 2 | +import re |
2 | 3 | from pathlib import Path
|
3 | 4 | from typing import List, Tuple, Optional
|
4 | 5 |
|
@@ -32,6 +33,7 @@ def file_filter(file: Path) -> bool:
|
32 | 33 | "--nologo",
|
33 | 34 | f"-p:AssemblyName={name}",
|
34 | 35 | f"-p:StartupObject=Tested.{name}",
|
| 36 | + "-consoleloggerparameters:NoSummary", |
35 | 37 | ]
|
36 | 38 |
|
37 | 39 | return args, file_filter
|
@@ -87,3 +89,25 @@ class {class_name}
|
87 | 89 |
|
88 | 90 | with open(solution, "w") as file:
|
89 | 91 | file.write(result)
|
| 92 | + |
| 93 | + def compiler_output( |
| 94 | + self, namespace: str, stdout: str, stderr: str |
| 95 | + ) -> Tuple[List[Message], List[AnnotateCode], str, str]: |
| 96 | + submission_name = self.with_extension(self.conventionalize_namespace(namespace)) |
| 97 | + message_regex = ( |
| 98 | + rf"{submission_name}\((\d+),(\d+)\): (error|warning) ([A-Z0-9]+): (.*) \[" |
| 99 | + ) |
| 100 | + messages = re.findall(message_regex, stdout) |
| 101 | + annotations = [] |
| 102 | + for message in messages: |
| 103 | + annotations.append( |
| 104 | + AnnotateCode( |
| 105 | + row=int(message[0]), |
| 106 | + text=message[4], |
| 107 | + externalUrl="https://learn.microsoft.com/dotnet/csharp/language-reference/compiler-messages/", |
| 108 | + column=int(message[1]), |
| 109 | + type=message[2], |
| 110 | + ) |
| 111 | + ) |
| 112 | + |
| 113 | + return [], annotations, stdout, stderr |
0 commit comments