Extending BlameLine functionality

27 views
Skip to first unread message

gr3...@gmail.com

unread,
Oct 27, 2017, 10:26:55 AM10/27/17
to SonarQube

Hi, I'm new to Sonar and I'd like to extend the BlameLine object for various SCM providers to provide more information about a commit such as displaying the comments. 

I've managed to store the information I want in the object by extending BlameLine into a CustonBlameLine and modifying the plugin to deal with the new attributes, and this doesn't break or prevent the existing date, author and revision blame information from being displayed/logged, but it obviously doesn't display the new info on the project nor can I be sure that it actually saves the information in the MySQL database. 


Has this kind of thing been done before? The source code for all of the SCM plugins I've looked at just uses the default BlameLine with the three author, date and revision attributes.


I looked around but I can't find much on creating Sonar frontend widgets and dealing with blame information.


Thanks for your help.

G. Ann Campbell

unread,
Oct 27, 2017, 2:26:44 PM10/27/17
to SonarQube
Hi,

I saw your post on SO yesterday (thanks for waiting at least a day before re-posting here!) and was tempted to answer, but that didn't really seem the right place for what I had to say, which was:

You're not going to be able to do what you're after. There's no provision for extensibility in that part of the interface. Instead, I think the best you can hope for is to pre-link the commit hash to the SCM's web UI (assuming your value won't be escaped - which it's likely to be) or maybe "corrupt" the hash with the comment data. 

In general tho, while I can kinda see why you might want to go in this direction, IMO you should be cautious about overloading the UI with potentially extraneous data. And yes, the developer who wants to put War and Peace into a commit comment is rare as hens' teeth, but I think he's probably out there. So at the very least, you might want to consider a char limit on what you pull over.


Ann

gr3...@gmail.com

unread,
Oct 27, 2017, 2:37:14 PM10/27/17
to SonarQube
Thanks for the reply! I decided that this might be a more appropriate place for my question over SO, so I removed the SO post and moved it here.

This is what I was assuming the case was. Thanks for the input. I'll explore other avenues.

alex.se...@gmail.com

unread,
Oct 30, 2017, 3:39:56 PM10/30/17
to SonarQube
Hi Ann,

Thank you for your prompt reply to Chris. We're totally with you as far as exercising common sense putting information into the "bubble-popup." We are working with the ClearCase SCM plugin (https://github.com/aseriy/sonar-scm-clearcase) and exploring some specific CC users' requirements where we need to go beyond the 3 lines. We understand that The BlameLine class in the API has only 3 fields. We extend this class to add more information. We are cognizant of the fact that some users may go bananas with the comments, and we're limiting how long a comment string gets sent to Sonar.

While Chris figured out how to extend the BlameLine class, we couldn't quite figure out how to extend the UI counterpart, thus his post here. I seemed reasonable to both of us that a <div> could be extended beyond 3 lines:





If you can advise on what would be involved to achieve that, we greatly appreciate it.

Thank you loads in advance,
Alex
Auto Generated Inline Image 1
Auto Generated Inline Image 2

G. Ann Campbell

unread,
Oct 30, 2017, 3:48:40 PM10/30/17
to alex.se...@gmail.com, SonarQube
Hi Alex,

As I said earlier, this part of the UI is not extensible. 


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/5k0mm8ef70I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/d2282e7e-1371-4ef8-beb8-5e23a3a67e5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages