Skip to content

Commit 5201e6f

Browse files
committed
Read and show contexts in warnings if available
1 parent 80651da commit 5201e6f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/api/messages/GoblintMessagesResult.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
55
import com.ibm.wala.util.collections.Pair;
66
import magpiebridge.core.AnalysisResult;
7+
import org.thymeleaf.context.IContext;
78

89
import java.io.File;
910
import java.net.MalformedURLException;
@@ -58,6 +59,11 @@ public interface MultiPiece {
5859
public static class Piece implements MultiPiece {
5960
private String text;
6061
private GoblintLocation loc;
62+
private context context;
63+
64+
public static class context {
65+
private Integer tag;
66+
}
6167

6268
/**
6369
* Converts the Single (Piece type of) Goblint messages from the
@@ -70,7 +76,8 @@ public static class Piece implements MultiPiece {
7076
*/
7177
public List<AnalysisResult> convert(List<Tag> tags, String severity, boolean explode) {
7278
GoblintPosition pos = getLocation(loc);
73-
String msg = joinTags(tags) + " " + text;
79+
String ctx = context == null || context.tag == null ? "" : " in context " + context.tag;
80+
String msg = joinTags(tags) + " " + text + ctx;
7481
GoblintMessagesAnalysisResult result = new GoblintMessagesAnalysisResult(pos, msg, severity);
7582
return List.of(result);
7683
}

0 commit comments

Comments
 (0)