2
1
0

The Jenkins verify build does execute the CI tests, but is there a way to confirm how the metrics look in Sonar before the code is merged?

I'm assuming the merge will result in a build that updates sonar, but it would be handy if there was a way to check on incremental progress before requesting the merge.

    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      You can integrate sonarlint into your IDE. I'm using intellij and have connected it to sonar.onap.org to pull ONAP sonar profile locally.You can pull the patch, run sonarlint and it will tell you the issues locally and allow you to see if they are resolved.


      1. Dominic Lunanuova

        Thanks for the hint Marcus.  Since I didn't have intellij setup I investigated further and discovered some lack of understanding in my original question.  In case others have the same confusion:

        • Sonar GUI is used in ONAP to display code coverage metrics (in addition to bugs, smells and vulnerabilities)
        • The actual code coverage metrics are created by a tool called JaCoCo.
        • JaCoCo can be integrated into various IDE (e.g. intellij or Eclipse), but also supports a command line interface

        I was able to quickly download the JaCoCo library, and execute a command line report to generate an html file which displayed code coverage.  See http://www.eclemma.org/jacoco/

      2. Dominic Lunanuova

        Using this spot  to capture the command I used on ubuntu 16.04 dev environment:

        • download and install jacoco library
        • locate reference to jacoco-ut.exec file in build output
        • from jacoco/lib run:
        java -jar ./jacococli.jar report <path to>/jacoco-ut.exec \
        --classfiles <path to>i/target/classes --html $HOME/jacoco.html





      CommentAdd your comment...
    2.  
      2
      1
      0

      To see Sonar results in Eclipse, install SonarLint, https://www.sonarlint.org/eclipse/. Then you can bind your projects to the ONAP Sonar.


      But you will only see tiems regarding static code analysis. To see code coverage, you also need to install EclEmma, https://www.eclemma.org/installation.html.

        CommentAdd your comment...