[NEW PLUGIN] Requesting inclusion of Sonar Community Gosu plugin in Sonar Marketplace

Overview
We, FRIDAY Insurance S.A, have implemented a Sonar plugin for the Gosu Programming Language. The plugin has been in internal use for a couple of years now and, as of 2023, we decided to open-source it.
We would like to include it in the marketplace, so other companies, mostly in the insurtech space, can use it as well.

Plugin Details

Description: Gosu Programming Language Plugin for SonarQube
Home page URL: https://github.com/FRI-DAY/sonar-gosu-plugin
Plugin Key: communitygosu
SonarCloud URL: https://sonarcloud.io/summary/new_code?id=FRI-DAY_sonar-gosu-plugin
Issue Tracking: https://github.com/FRI-DAY/sonar-gosu-plugin/issues
Plugin Binary URL: https://github.com/FRI-DAY/sonar-gosu-plugin/releases
Sample Gosu Project: simple-gosu-project (Other sample Gosu projects can be found here)
Sonar Update Center PR: https://github.com/SonarSource/sonar-update-center-properties/pull/406

Thank you!

3 Likes

Hi,

Welcome to the community and congrats on your new plugin!

I want to let you know that I have a little backlog at the moment, so it will be a few days before I can look closely at this. But you’re on my list.

 
Ann

Hi again,

I was able to come back to this today.

My SonarQube 9.9 server won’t start with your plugin. The error in web.log is this:

2023.04.10 12:26:02 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceFilter@539316bb [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/components/update_key, ...]}]
2023.04.10 12:26:02 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2023.04.10 12:26:02 INFO  web[][o.s.s.p.DetectPluginChange] Detect plugin changes
2023.04.10 12:26:02 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalStateException: Fail to load plugin Community Gosu Plugin [communitygosu]
	at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:81)
	at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:655)
	at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:196)
	at org.sonar.server.platform.PlatformImpl.startLevel34Containers(PlatformImpl.java:177)
	at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(PlatformImpl.java:344)
	at org.sonar.server.platform.PlatformImpl$1.doRun(PlatformImpl.java:105)
	at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.run(PlatformImpl.java:328)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NoClassDefFoundError: org/sonar/api/profiles/ProfileDefinition
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
	at org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125)
	at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37)
	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
	at de.friday.sonarqube.gosu.GosuPlugin.define(GosuPlugin.java:35)
	at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:71)
	... 7 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.sonar.api.profiles.ProfileDefinition
	at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
	... 21 common frames omitted
2023.04.10 12:26:02 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process

And in fact, in your PR, you’ve indicated that your plugin is only compatible with version 8.9. Unfortunately, 8.9 is officially EOL. I had been hoping this compatibility specification was an oversight on your part. That’s why I tried starting up with it anyway.

While I think your coverage for Gosu would be a great addition to the community ecosystem, unfortunately, I can’t add it to the marketplace until it’s compatible with at least the current LTS.

As a side note, while your plugin passes the bureaucratic requirements (thanks for having your ducks in a row!) you’ve overlooked the requirement to register your plugin’s properties file in the update-center-source.properties file.

 
Ann

Hi Ann.

Thanks for the quick feedback.

We are working on making the plugin compatible with the latest LTS version. I will let you know once this is addressed.

Thanks for pointing out the missing registration on the update-center-source.properties file. I will fix it right away.

Best regards,

Josimar.

1 Like

Hi Ann.

Just letting you know that we have updated the plugin to be compatible with Sonar 9+.

The latest release, v1.2.1, fixed all the issues that were making the plugin incompatible with the Sonar LTS version.

I’ve also updated the update-center-source.properties file with the new plugin release.

Best regards,

Josimar

1 Like

Hi Josimar,

I’m running Java 17 & getting this in analyzing the demo project you provided:

FAILURE: Build failed with an exception.

* Where:
Settings file '/home/anncampbell/testProjects/gosu/simple-gosu-project/settings.gradle'

* What went wrong:
Could not compile settings file '/home/anncampbell/testProjects/gosu/simple-gosu-project/settings.gradle'.
> startup failed:
  General error during semantic analysis: Unsupported class file major version 61
  
  java.lang.IllegalArgumentException: Unsupported class file major version 61
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)
        at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)

I haven’t used Gradle much, so my first though was that maybe I was running an old version, but I don’t actually seem to have it installed. It looks like ./gradlew uses what you ship in the project…?

 
Ann

Hi Ann.

Gosu still does not have support for Java 17. The sample project needs to build using Java 11.

After building with Java 11, using the ./gradlew build command, you should see the message as follows:

Best regards,

Josimar.

Hi Josimar,

One of the requirements to enter the Marketplace is that the plugin is “compatible with the platform requirements”. The requirements for 9.9 include analyzing with Java 11 or Java 17.

I’m trying to justify that it’s okay to not meet that requirement since Gosu developers naturally wouldn’t be analyzing with Java 17 if their compilation doesn’t support it…? (Help me out here, please.)

And while I ponder this question, I plan to switch JVMs and re-try the test.

 
Ann

Hi,

Generally this looks good in my testing, but you don’t seem to have provided the ncloc_data metric, and that’s required in item 9.

 
Ann

1 Like

Hi Ann,

I’ve opened an issue on the Gosu Lang repository asking if there’s a timeframe for it to support JDK 17. No answer so far. Although the plugin itself will work fine in a scanner using JDK 17, at the moment, is not possible to have a Gosu project with JDK 17 to run the scanner against.

We actually have implemented it. In fact, we used the Java implementation mentioned on the marketplace checklist as a reference to implement ours.

On our tests it seems to be working as expected.

Can you provide the process you use to check this metric, please? So we can check on our side what’s the issue.

Best regards,

Josimar.

Hi Josimar,

Of course! It was failing on the compile! I’ve switched back to Java 17 and skipped compile and it runs without errors. So we can cross this off the list.

Ehm… It was actually pretty naive: http://localhost:9000/api/measures/component?component=simple-gosu-project&metricKeys=ncloc,ncloc_data

Aaand… I see now that ncloc_data doesn’t come back for projects with natively-implemented langauges, so I’m checking internally on how best to validate this.

Sorry for the confusion. And I’ll come back when I’ve got more. Or by the end of the week. Whichever is sooner.

 
Ann

1 Like

Hi,

It’s not looking feasible / reasonable to check ncloc_data, so I’ll just take you at your word. :smiley:

I’ve asked for a small change in your PR (I’m persuadable if you disagree with it) and then we’re good to go.

 
Ann

1 Like

Hi Ann,

that’s great news. :smiley:

I’ve updated the PR accordingly.

Josimar

1 Like

Hi,

You’re in!

Thanks for this great new addition to the ecosystem!

 
Ann

1 Like

Hi,

Yay :smiley: !!!

Thanks for all the help, Ann.

Best regards,

Josimar.