Skip to content

Commit

Permalink
Merge pull request #69 from goblint/contexts
Browse files Browse the repository at this point in the history
Read and show contexts in warnings if available
  • Loading branch information
karoliineh authored Feb 19, 2024
2 parents 80651da + 1d360b9 commit b042082
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/api/messages/GoblintMessagesResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public interface MultiPiece {
public static class Piece implements MultiPiece {
private String text;
private GoblintLocation loc;
private context context;

public static class context {
private Integer tag;
}

/**
* Converts the Single (Piece type of) Goblint messages from the
Expand All @@ -70,7 +75,8 @@ public static class Piece implements MultiPiece {
*/
public List<AnalysisResult> convert(List<Tag> tags, String severity, boolean explode) {
GoblintPosition pos = getLocation(loc);
String msg = joinTags(tags) + " " + text;
String ctx = context == null || context.tag == null ? "" : " in context " + context.tag;
String msg = joinTags(tags) + " " + text + ctx;
GoblintMessagesAnalysisResult result = new GoblintMessagesAnalysisResult(pos, msg, severity);
return List.of(result);
}
Expand Down

0 comments on commit b042082

Please sign in to comment.