简体   繁体   中英

Sonar Plugin - View Source Code

I'm writing a small Sonar Plugin for Abap Code. I alread have presented metrics in Sonar, and also have the source Code of some Abap Files in the Sonar Database (i checked it with a sql client). But now I really have no clue how could I present this source code with sonar. I already looked through the sonar source code and some sonar plugins (like the CXXPlugin https://github.com/SonarCommunity/sonar-cxx which also have the Function to output the source Code), but I didn't get smarter. Is there an easy way how to present source code with the sonar api? Is there any kind of SourceViewer part of the Sonar Core ( https://github.com/SonarSource/sonar ).


EDIT: I'm now one step closer but I have a problem with the drilldown-view. My erb-file has the following code snippet:

 %= format_measure(loc_measure, :suffix => '', :url => url_for_drilldown(loc_measure)) -%> 

But my drilldown view do not list the sources which I have in my folder which was analysed by sonar: 在此处输入图片说明

In my Database I looked at the table 'projects': 在此处输入图片说明

Afterwards I tried to directly link in the drilldown view to a source file (in that case with the id 122) and it worked: 在此处输入图片说明

So my question is, why are the subfolder and source files not listed like classes and package in a normal Java project?

You can take a look at some of our open-source language plugins that we develop for Sonar. For instance, you can go and see the Javascript plugin - which is probably a better option that the CXX plugin that is not developed by us and there that may not fully comply with our conventions and coding best-practices & guidelines.

To sum up:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM