sfeir-open-source / sonar-clover

It provides the ability to feed SonarQube with code coverage data coming from Atlassian Clover
Apache License 2.0
15 stars 25 forks source link

Updated to use new coverage API #15

Closed mlschechter closed 5 years ago

mlschechter commented 6 years ago

Modified the sonar-clover plugin to use the 6.x+ API for plugins; added test cases to cover Clover-specific scenarios (for example, lines of code excluded from coverage calculations via Clover's contexts).

All unit and integration tests pass; I've also verified this works with SonarQube 7.2 by updating the integration test.

The only issue I could not resolve was DEV-based ITS. The travis-utils project does not support Gradle, and the latest on master of SonarQube is Gradle-based.

mlschechter commented 6 years ago

@Tony-Proum - Can you please merge and release?

omgapuppy commented 6 years ago

would be great to get this merged 👍

Tony-Proum commented 6 years ago

Sorry for the delay, I'm on vacation for a few more days. I'll check this merge request when backed to a place where the network connection will be more efficient

mlschechter commented 6 years ago

@Tony-Proum,

How's the schedule looking for a release?

mlschechter commented 6 years ago

@Tony-Proum,

I've got your changes merged in, and the build passes. Any chance we can get a release? 😃

Thanks in advance!

Tony-Proum commented 6 years ago

@mlschechter :smile: I'm working on it

heruan commented 5 years ago

Is this supposed to bring support also for SQ 7.3?

I've tried to install manually but I'm getting

java.lang.ClassNotFoundException: org.sonar.api.utils.StaxParser$XmlStreamHandler
    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)
    at org.sonar.plugins.clover.CloverSensor.execute (CloverSensor.java:72)
    at org.sonar.scanner.sensor.SensorWrapper.analyse (SensorWrapper.java:45)
    at org.sonar.scanner.phases.SensorsExecutor.execute (SensorsExecutor.java:88)
    at org.sonar.scanner.phases.SensorsExecutor.execute (SensorsExecutor.java:62)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute (AbstractPhaseExecutor.java:74)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart (ModuleScanContainer.java:166)
    at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:122)
    at org.sonar.scanner.scan.ProjectScanContainer.scan (ProjectScanContainer.java:300)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively (ProjectScanContainer.java:295)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively (ProjectScanContainer.java:293)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart (ProjectScanContainer.java:269)
    at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:122)
    at org.sonar.scanner.task.ScanTask.execute (ScanTask.java:48)
    at org.sonar.scanner.task.TaskContainer.doAfterStart (TaskContainer.java:82)
    at org.sonar.core.platform.ComponentContainer.startComponents (ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute (ComponentContainer.java:122)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask (GlobalContainer.java:131)
    at org.sonar.batch.bootstrapper.Batch.doExecuteTask (Batch.java:116)
    at org.sonar.batch.bootstrapper.Batch.execute (Batch.java:71)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute (BatchIsolatedLauncher.java:46)
Tony-Proum commented 5 years ago

ping @mlschechter

mlschechter commented 5 years ago

As I mentioned in another thread, in SonarQube 7.3 they removed the deprecated code that's been around (and deprecated) since 6.0. My recommendation is that we create a release that is compatible with 6.0 -> 7.2, and create a new issue to go in and replace the deprecated code.

Could you please let me know if that sounds reasonable?

Thanks!

Tony-Proum commented 5 years ago

@mlschechter The build is now fixed. I've tried to initiate a project : https://github.com/Tony-Proum/sonar-clover/projects/1 you should be able to follow what's happen in the project now. those issue have to be fix before merging this PR:

mlschechter commented 5 years ago

@Tony-Proum,

I had some time, so I removed the deprecated code. Within this branch, the acceptance tests for Java (CloverTest) pass against 6.7.5 and 7.4; the Groovy tests only pass for pre-7.2, as they deprecated the Groovy plugin and it no longer works for later versions of SonarQube.

smarkey commented 5 years ago

@mlschechter, since this is taking a while to get merged, could you make your changes available on a public fork so I can checkout your branch and generate the jar myself. Would really appreciate it!!

heruan commented 5 years ago

@smarkey Isn't the branch already public at https://github.com/NCR-Corporation/sonar-clover/tree/topic%2FNEP-10592?

mlschechter commented 5 years ago

@smarkey / @heruan - yes, the repository should be public. Please let me know if it isn't and I'll see if I can fix that.

smarkey commented 5 years ago

🤦‍♂️ yes, it is - apologies!

Tony-Proum commented 5 years ago

@mlschechter could you please update the branch ? or would you like to create a branch directly on this repository (in order to be able work together on this topic ?)

It's not really handy to work on two repository as the changes are pretty big

mlschechter commented 5 years ago

@Tony-Proum,

Let me take a look at the work involved. Can you please let me know which branch I need to merge out from? I'm guessing it's master. 😄

Thanks!

CLAassistant commented 5 years ago

CLA assistant check
All committers have signed the CLA.

mlschechter commented 5 years ago

@Tony-Proum,

I've got the code merged; there are build failures because it's not detecting the Sonar HTTP endpoint for the static analysis. I'm seeing this in the successful builds on master; can you please let me know what I need to do to fix things on my branch?

Setting environment variables from repository settings
$ export SONAR_HOST_URL=[secure]
$ export SONAR_ORGANIZATION=[secure]
$ export SONAR_PROJECT_KEY=[secure]
$ export SONAR_TOKEN=[secure]
Tony-Proum commented 5 years ago

Oh, it seems to be related to the way travis is dealing with variables : https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-settings I think that we could merge this branch into another feature branch in this repository in order to run all tests and quality analysis using travis. I'll try to see if there is another way to work with it and then if there is no other options, I'll create another branch here to merge this work

mlschechter commented 5 years ago

@Tony-Proum,

Thanks for identifying the issue - using a feature branch would definitely work for me. Still working on the CLA from my end.

mlschechter commented 5 years ago

CLA signed

mlschechter commented 5 years ago

@Tony-Proum,

Is there anything you need from me to get this pull request moving?

mlschechter commented 5 years ago

@Tony-Proum,

Can you please let me know if there's anything I can do to expedite this pull request?

Thanks!

Tony-Proum commented 5 years ago

Hi, sorry for the delay, I were working on another projects. I've to re-dive into this subject. I'll give you some update soon

Tony-Proum commented 5 years ago

I've update the travis config in order to allows contributors to work using their own forks. I've now had to create some integration test in order to see if nothing is broken using this PR and we will be allowed to Merge it in upstream ! stay tuned