How to use CodePointers in Checks API correctly

13 views
Skip to first unread message

Kate

unread,
Dec 17, 2025, 9:52:29 AM (16 hours ago) Dec 17
to Repo and Gerrit Discussion
Hi,

I am trying to develop a Checks API plugin that reads issues from a SonarQube server and reports them to Gerrit.

I can retrieve the issues fine and find the ones that are relevant to a Gerrit change.

But I have an issue linking them to the code locations in Gerrit.

I found a comment here that tells me that inline comments should be possible by using a CodePointer. I tried that, but could not succeed yet.

Here is my issue:

I have the following CheckResult:
20251217-151040-004.png

The result is detected by Gerrit and displayed in the Checks tab:
20251217-150949-002.png

The file in the file list shows a badge for the error:
20251217-151010-003.png

So far, so good. But here the issues begin:

In the file, I do not see an inline comment that displays the issue again (I expected one from the information stated in the linked message above)

20251217-151142-006.png

And the link in the Checks tab has a target that results in a 404:
20251217-151419-001.png

A working link would for example be /c/test/+/1/4/SoftwareValidator.java#1314, including the patchset number.
Yet, the link that Gerrit generates for me does not include the patchset number and therefore does not work.

Can the Checks API display an inline comment in the source file? If yes, how does my CheckResult need to look like for the comment to be displayed?

How does my CheckResult need to look like so that a working link is generated in the Checks Tab?

Gerrit Version is 3.13.1

Thanks,
Kate

Nasser Grainawi

unread,
Dec 17, 2025, 7:54:54 PM (6 hours ago) Dec 17
to Kate, Repo and Gerrit Discussion
Yes, this should work. Your example seems really close, so maybe there's just something small that's off. I think the 'range' in code pointers is pretty sensitive, so you could try setting the start_character and end_character to 0 to see if that works. You can also compare your structures to the CheckRun examples in the test data generators.

The missing patchset number is suspicious, but I'm not sure what it points to.

Nasser
 

Gerrit Version is 3.13.1

Thanks,
Kate

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/repo-discuss/5119be03-1ebf-4a4e-a72e-ca146968c2a6n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages