Scalastyle integration in sonar

1,473 views
Skip to first unread message

Thomas

unread,
Oct 16, 2013, 5:06:25 AM10/16/13
to scalasty...@googlegroups.com
Can scalastyle be intregrated in sonar?

Having scalastyle results and warnings visible in the sonarQube Dashboard would be very usefull.

Matthew Farwell

unread,
Oct 17, 2013, 2:26:25 AM10/17/13
to scalasty...@googlegroups.com
There is a fledging project http://docs.codehaus.org/display/SONAR/Scala+Plugin which will include Scalastyle, but there isn't anything at the minute.

Have fun,

Matthew Farwell.


Le 16 octobre 2013 11:06, Thomas <thomas....@springer.com> a écrit :
Can scalastyle be intregrated in sonar?

Having scalastyle results and warnings visible in the sonarQube Dashboard would be very usefull.

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes Scalastyle users.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse scalastyle-use...@googlegroups.com.
Pour envoyer un message à ce groupe, adressez un e-mail à scalasty...@googlegroups.com.
Visitez ce groupe à l'adresse http://groups.google.com/group/scalastyle-users .
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .

Mike Marich

unread,
Nov 12, 2013, 7:52:02 PM11/12/13
to scalasty...@googlegroups.com
I forked the sonar-scala plugin at https://github.com/mmarich/sonar-scala and added parsing for junit xml files as produced by https://github.com/bseibel/sbt-simple-junit-xml-reporter-plugin.

I have also added parsing of cobertura-format reports as produced by scct.

I am not looking to do the same with checkstyle reports, as that is what scalastyle produces.

I am not in a rush to make this happen, but I could set a day or two aside if anyone else would find this useful.

Matthew Farwell

unread,
Nov 22, 2013, 1:34:39 PM11/22/13
to scalasty...@googlegroups.com

Hello,

I think this would be useful for a lot of people. It has been on my list of things to do for a long time - to integrate with the sonar plugin.

Thanks.

Matthew Farwell

Eric Pabst

unread,
Feb 24, 2014, 10:32:00 AM2/24/14
to scalasty...@googlegroups.com
I would find it very useful.  I'm also hoping for a non-SNAPSHOT version we can use.

Mike Marich

unread,
Feb 24, 2014, 1:50:18 PM2/24/14
to scalasty...@googlegroups.com
Thanks, we are still sorting out code coverage and the migration to scoverage. We will probably remove the dependency on the checkstyle plugin from the scala plugin.


2014-02-24 7:32 GMT-08:00 Eric Pabst <epa...@gmail.com>:
I would find it very useful.  I'm also hoping for a non-SNAPSHOT version we can use.

--
Vous recevez ce message car vous êtes abonné à un sujet dans le groupe Google Groupes "Scalastyle users".
Pour vous désabonner de ce sujet, visitez le site https://groups.google.com/d/topic/scalastyle-users/ALzi6pVJe3o/unsubscribe.
Pour vous désabonner de ce groupe et de tous ses sujets, envoyez un e-mail à l'adresse scalastyle-use...@googlegroups.com.

Pour envoyer un message à ce groupe, adressez un e-mail à scalasty...@googlegroups.com.
Visitez ce groupe à l'adresse http://groups.google.com/group/scalastyle-users .
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .



--


Mike Marich
Engineering Manager, West Coast
Dominion Marine Media
Mobile: 
604-315-5762
Home: 604-321-1904
Fax: 604-681-5110
mma...@boats.com
 
Join YachtWorld.com/social-media
Join Boats.com/social-media

Emrehan Tüzün

unread,
Jun 26, 2014, 3:45:38 AM6/26/14
to scalasty...@googlegroups.com
Hello,

I want to contribute the integration of Scalastyle with SonarQube. Sonar Scala plugin has been inactive for two months.

Is any of you would like to guide me through the process?

Thanks,

Emrehan

Matthew Farwell

unread,
Jun 28, 2014, 5:06:03 AM6/28/14
to scalasty...@googlegroups.com
I haven't looked at this in a while, but would be happy to help you do it - at least to give you advice on how to do it.

I'm not quite sure where to start - have you tried forking and compiling the current version?

Then have a look at the following guide: http://docs.codehaus.org/display/SONAR/Coding+a+Plugin

If you have any problems, please don't hesitate to contact me,

Have fun,

Matthew.


--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "Scalastyle users".

Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse scalastyle-use...@googlegroups.com.
Pour envoyer un message à ce groupe, envoyez un e-mail à l'adresse scalasty...@googlegroups.com.

Visitez ce groupe à l'adresse http://groups.google.com/group/scalastyle-users.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Emrehan Tüzün

unread,
Jun 30, 2014, 4:17:27 AM6/30/14
to scalasty...@googlegroups.com
Hello,

Yes, I’ve compiled the sonar-scala-plugin and read pretty much all of the "Developing Plugins" title on Sonar docs.

As far as I understand the sonar-scala-plugin is evaluating the source files itself, instead of running Scalastyle and parsing its output. On the other hand, I've looked into the source code of sonar-adam-plugin which is processing the xml Adam output and shows the results in a custom sonar widget.

Running Scalastyle and parsing its output would be a better way, right? If so, do you know any other similar plugins since the sonar-adam-plugin has a somewhat poor documentation?

Best,

Emrehan

Mike Marich

unread,
Jul 1, 2014, 2:27:03 PM7/1/14
to scalasty...@googlegroups.com
I would prefer to run scalastyle and make use of the output - why reinvent the wheel?

This will also help promote scalastyle integration in projects under development, which is a good thing.


--
Vous recevez ce message, car vous êtes abonné à un sujet dans le groupe Google Groupes "Scalastyle users".

Pour vous désabonner de ce sujet, visitez le site https://groups.google.com/d/topic/scalastyle-users/ALzi6pVJe3o/unsubscribe.
Pour vous désabonner de ce groupe et de tous ses sujets, envoyez un e-mail à l'adresse scalastyle-use...@googlegroups.com.
Pour envoyer un message à ce groupe, envoyez un e-mail à l'adresse scalasty...@googlegroups.com.
Visitez ce groupe à l'adresse http://groups.google.com/group/scalastyle-users.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Matthew Farwell

unread,
Jul 1, 2014, 3:01:09 PM7/1/14
to scalasty...@googlegroups.com
Hi,

A number of the plugins (notably the sbt plugin) can produce xml output, which is checkstyle compatible - a good start would be to produce this and just look at the existing code for parsing the checkstyle stuff, and reproducing that for sonar.


Have fun,

Matthew Farwell.

Emrehan Tüzün

unread,
Jul 2, 2014, 3:45:29 AM7/2/14
to scalasty...@googlegroups.com
Hi,

Yes Mike, I think its' a much better approach to have separate modules to generate the code checking logic and to integrate it into quality management platform too. Strangely, the Sonar community's approach is to handle all the evaluation on the plugins itself.

Matthew, thanks for pointing out the resources, they will help. Until now, I've been looking into sonar-scala-plugin (to see how to handle language report, partly written in scala), sonar-scoverage-plugin (the only sonar plugin written in scala), sonar-adam-plugin.

​I've created the bare minimum yesterday and its hosted on github.com/emrehan/sonar-scalastyle-plugin.

My current roadmap is to:
  • Kick sonarqube and create the xml output
  • Read the scalastyle-output.xml from the path specified on sonar-project.properties
  • Parse the output​
  • Display it on the SonarQube

I'm glad to be on the track you've pointed out.

I'll keep you updated and to I'd love to have some feedback.

Best,

Emrehan

Mike Marich

unread,
Jul 2, 2014, 11:25:23 AM7/2/14
to scalasty...@googlegroups.com
Awesome, I can't wait to try it =)

Emrehan Tüzün

unread,
Jul 7, 2014, 4:49:26 AM7/7/14
to scalasty...@googlegroups.com
Hi,

I'm facing some problems with developing the plugin since the Sonar API has recently changed and there isn't much documentation nor new examples. I've posted my questions on SonarQube Developers mail group. Though the questions are specific to developing language plugins to Sonarqube, I wanted to share the post here too.

All the best,

Emrehan

Henry Coles

unread,
Jul 11, 2014, 4:23:54 PM7/11/14
to scalasty...@googlegroups.com


On Monday, 7 July 2014 09:49:26 UTC+1, Emrehan Tüzün wrote:

I'm facing some problems with developing the plugin since the Sonar API has recently changed and there isn't much documentation nor new examples. I've posted my questions on SonarQube Developers mail group. Though the questions are specific to developing language plugins to Sonarqube, I wanted to share the post here too.

We had a hack day at the office a few weeks ago and threw together a working plugin.

Details are here for anyone interested 

http://ncredinburgh.com/blog/posts/scala-style-sonar-plugin

It's in a working state - we want to spend a bit of time using it before we cut a release, but it's easy enough to build.

Henry

Emrehan Tüzün

unread,
Jul 12, 2014, 12:36:47 AM7/12/14
to scalasty...@googlegroups.com
Hi Henry,

It's nice to see you also want to solve the same issue.

My plugin 
​works​
but at the same time I liked yours ​too
​. ​
Both plugins need more job to do and it would be better for the community if everyone work on the same plugin.​

Is your plugin open to contribution​s and is someone on charge maintaining NCR projects?

​All the best,​

​Emrehan​


--

Henry Coles

unread,
Jul 12, 2014, 4:36:57 AM7/12/14
to scalasty...@googlegroups.com


On Saturday, 12 July 2014 05:36:47 UTC+1, Emrehan Tüzün wrote:

Hi Emrehan,
 
Is your plugin open to contribution​s and is someone on charge maintaining NCR projects?


Unfortunately we look to have started at pretty much the same time, but yes definitely we're open to contributions if there are things we could merge in from your code.

The person in charge of maintaining this one would be me. I'll be mostly out of contact for the next week or so any pull requests might not get looked at until I get back.

Thanks

Henry

Emrehan Tüzün

unread,
Jul 21, 2014, 3:11:24 AM7/21/14
to scalasty...@googlegroups.com
Hi Everyone,

We have a working plugin. You can check it out at github.com/emrehan/sonar-scalastyle.

Any feedback will be greatly appreciated!

Best,

Emrehan

Matthew Farwell

unread,
Jul 27, 2014, 9:41:30 AM7/27/14
to scalasty...@googlegroups.com
This looks great - it seems to work. This is something I've been meaning to do for a long time, and is sorely needed.

I have one bit of feedback - there seems to be a problem with the descriptions of the rules in the code section at the bottom - for instance, when I click on the 'Cyclomatic complexity', it displays the 'Too many classes / file' message.

If there is something that I can do to help the plugin work, please let me know.

Thanks a lot.

Matthew Farwell.


--

Emrehan Tüzün

unread,
Jul 27, 2014, 10:19:30 AM7/27/14
to scalasty...@googlegroups.com
Hi,

I'm on a vacation with very limited internet connection, I'll handle it in 4 days. Thank you for your interest
​ and feedback​
:)

​Best,

Emrehan​

Artur Stanek

unread,
Aug 8, 2014, 4:07:03 AM8/8/14
to scalasty...@googlegroups.com
Hi,

thanks for great work!!!!! I hope it is a beginning of something that we all waited for!! :))

Currently I am using 'scalastyle-sbt-plugin' do generate configuration file scalastyle-config.xml (and of course to run analysis, target/scalastyle-result.xml). It would be good to give to users ability to configure location of configuration file ... or it is possible but I missed where to configure it?

Second question: how hard it would be to create sbt-sonar-scalastyle plugin to allow execution of analysis straight from SBT? For example, you execute command 'sonar-scalastyle' in SBT and it goes also to all aggregated (sub)projects. 

Thanks,
Arthur. 

Henry Coles

unread,
Aug 11, 2014, 9:22:37 AM8/11/14
to scalasty...@googlegroups.com


On Sunday, 27 July 2014 14:41:30 UTC+1, Matthew Farwell wrote:
This looks great - it seems to work. This is something I've been meaning to do for a long time, and is sorely needed.

I have one bit of feedback - there seems to be a problem with the descriptions of the rules in the code section at the bottom - for instance, when I click on the 'Cyclomatic complexity', it displays the 'Too many classes / file' message.


The descriptions are taken from the "scalastyle_documentation.xml" file that's packaged with scala style. The incorrect description looks to be due to a bug in this file.

Henry

Henry Coles

unread,
Aug 11, 2014, 9:40:29 AM8/11/14
to scalasty...@googlegroups.com

On Friday, 8 August 2014 09:07:03 UTC+1, Artur Stanek wrote:
Hi,

thanks for great work!!!!! I hope it is a beginning of something that we all waited for!! :))

Currently I am using 'scalastyle-sbt-plugin' do generate configuration file scalastyle-config.xml (and of course to run analysis, target/scalastyle-result.xml). It would be good to give to users ability to configure location of configuration file ... or it is possible but I missed where to configure it?


The rules are configured via the sonar quality profile rather than via a configuration file. This is "the sonar way".

There's pros and cons to it, on the plus side it means you can easily have a single easily maintained + centralised configuration that is applied to all projects. On the minus side it's a pain if you want to vary things by project (although you can do this under project settings) and the config isn't version controlled.

We've not had much experience of how this plays out with ScalaStyle and sonar yet. For Java maintaining the myriad static analysis tool configs across various projects is painful and the sonar approach is much preferable.

We have an internal jshint sonar plugin (for javascipt) that we use in preference to sonar's built in support, so the situation in analogous to scalastyle. With that we've found that we end up using different sets of rules for local developer machine analysis vs the server side soanr config, so again we've ended up preferring the sonar approach.

So it might be possible to have the plugin read rules from a project specific config file, but I'm not sure it's a good idea.
 
Second question: how hard it would be to create sbt-sonar-scalastyle plugin to allow execution of analysis straight from SBT? For example, you execute command 'sonar-scalastyle' in SBT and it goes also to all aggregated (sub)projects. 


Doesn't sound too hard, but I'm left wondering why the scalastyle-sbt-plugin doesn't already do this.

Cheers

Henry

Tomasz Mosiej

unread,
Nov 24, 2014, 8:27:58 AM11/24/14
to scalasty...@googlegroups.com
Hi,

 I forked the sonar-scala plugin and added experimental support for Scalastyle 0.6.0 and Scala 2.11 

Cheers,
 Tom

Mike Marich

unread,
Nov 24, 2014, 2:12:03 PM11/24/14
to scalasty...@googlegroups.com
Hi Tom,

Awesome! This was something I really needed to get to. I have not had much time for the Sonar Scala plugin as of late. I was actually going to ad the scoverage plugin and remove the cobertura one.

The Surefire plugin was a pretty bad mess. I committed a couple of fixes for it, but it should be dropped I think.

When would you feel comfortable having your fork pulled back into the official repo?

Also, we were talking about just migrating the entire plugin to Scala - do you have any thoughts on that?

Thanks,
Mike

--
Vous recevez ce message, car vous êtes abonné à un sujet dans le groupe Google Groupes "Scalastyle users".

Pour vous désabonner de ce sujet, visitez le site https://groups.google.com/d/topic/scalastyle-users/ALzi6pVJe3o/unsubscribe.
Pour vous désabonner de ce groupe et de tous ses sujets, envoyez un e-mail à l'adresse scalastyle-use...@googlegroups.com.

Pour envoyer un message à ce groupe, envoyez un e-mail à l'adresse scalasty...@googlegroups.com.
Visitez ce groupe à l'adresse http://groups.google.com/group/scalastyle-users.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.



--

Reply all
Reply to author
Forward
0 new messages