Open engrun opened 7 years ago
Hi, i setup the code to support multiple languages.
Main requirement to support a language is that i can create a Model (containing Package
and Class
connected to the SonarQube filesystem using a Location
). In other words an implementation of the AbstractSensor
class.
I'm not proficient in Groovy but i'll have a look at the SonarQube scanner to see if i can 'reuse' the code to create a Sensor.
The SonarQube scanner does not parse the source code itself. It relies on CodeNarc to detect issues in the files.
A quick search revealed some supporting tools (mainly the groovy parser/compiler itself); however that would take me a little too much time to dive into. However if you would like to give it a go, that would always be appreciated. I think the main steps would be as follows:
GroovySensor
that extends the AbstractSensor
(see JavaSensor
)JavaRules
)PackageAnalyzerPlugin
That should be all. The rules all work on the generic model so there should not be much to do there.
If possible gather all dependencies and supporting classes in a new project sonar-packageanalyzer-groovy
(see sonar-packageanalyzer-java
) and add that as a dependency to the plugin.
Hi. I took a quick look at the code (JavaSensor). However, it seems that this class references files which are not in the github-repo? Am I missing something?
Those files are created by the java project. That project repackages the sonarqube java frontend to extract and relocate those class files.
If you are using an IDE that links the projects you need to depend on the JAR from that project as opposed to the source files. In eclipse you can toggle 'Disable Workspace Resolution'. I'm guessing from the screenshot that you are using IntelliJ; i don't know how to do that in that IDE.
I would be nice if Groovy support could be in the roadmap. I'm aware it is a new initiative, but given the structure of the code with a specific "java" module, I hope that enhancing the plugin with other jvm based languages should be easy.
If it is a viable scope I may be able to assist or at least do a lot of testing etc.