Access syntax tree from custom serverside plugin?

Hi Adam,

No I don’t think this is possible. See it this way: the Syntax Tree is built by the analyzers during the analysis in order to detect issues; it is not persisted in any way at the end of the analysis. By ‘analysis’, I precisely refer to the scanner-side execution (server-side Background Task in no way manipulates the syntax tree).

I would argue that this use-case does not correspond to what the SonarQube APIs are intended to help with. SonarQube is about detecting bugs/vulnerabilities/code_smells , and computing code-related measures. It’s open and offers APIs for you to extend that, When I read ‘gather a list of all Java class fields annotated with a specific annotation in the source code, and upload that list someplace’ I do not see the relation with code quality and/or bug detection, so trying to do a SonarQube plugin for that purpose might end-up a very frustrating effort (not what the product and its APIs are designed for).

Ultimately I would advise to still consider non-SonarQube approaches for fulfilling your use-case here.

1 Like