Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read and show contexts in warnings if available #69

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading