SonarCloud with Github is not checking code duplicates

Hi There,

I need help regarding the sonarcube code check.
When we setup initially, it was checking code duplcaites and rest of the checks for my java based project.

But it’s not working from sometime. I have done setup again no luck.

And i need to run analysis on my whole code base it’s not in sync with code checks.

Can you guys help with this how to do that. I am not using CI based analysis, as my project have Angualr code and i can’t pass jar files in order to work on CI.

I am using Automatic Analysis method.

am I missing something to do the setup in order to work all functions properly. i am not looking into code-coverage analysis.

Thanks,
Srihari

Hey there

What exactly is not working? Maybe you can share some screenshots.

Hi Colin,

Thanks for replying. Though it has duplicates associated to the commit still it shows no duplicates.

And none of the code has been analyzed. And the main branch is not analysing and showing in the dash board either.

Find the screenshots.

Thanks!

After analysis also it says 0 Lines analyzed.

Hi there!

I had a quick look in our logs and it seems like all of your files are ignored during the analysis.
So there is probably some issues with your configuration.

You can tune the analysis with some additional configuration, you should try to define a correct sonar.sources parameter that match your project, see this documentation article for more information about the analysis scope.

About the main branch of your project, it is analyzed but you are seeing this message because it’s empty, there are no files in it.

Hi @Gregoire_Aubert ,

I am going through the documentation and it says

  • To be eligible for automatic analysis, your Java project must use either Maven or Gradle and the total amount of code in the project must be less than 10MB.

My project is mix of Angular and Java, and we don’t have Maven or Gradle

In order to use CI- based analysis it’s not working as we don’t have jar’s for this as code won’t create jar’s please guide us.

Thanks!

Hello,

If you don’t use Maven or Gradle then you won’t be able to analyze your Java code using the Automatic analysis. What tool do you use to build your Java code?

You could still only analyze your Javascript code using Automatic analysis. But you still need to configure correctly the sonar.sources properties so that your source files are analyzed.

Hi @Gregoire_Aubert ,

We use ant for doing build.

Would love to use CI based analysis.

But we have only non compiled .Java files.

In order to analyse just static Java classes which way is better.

Let me know.

Thanks,
Srihari

Ok, so you could use the SonarScanner for Ant on CI based analysis, check this documentation on how to setup.

Thanks for this, as i mentioned earlier my repo doesn’t have full framework it contains only custom code.

That’s the reason we cannot provide libraries to the ant task.

Is there any other way which we can do static code analysis.

It was working initially without having any tasks. But not from sometime.

Shall we connect?

Thanks,
Srihari

Ok, I see, so you won’t be able to analyze your Java code.
But using the Automatic analysis you should still be able to analyze your Angular code. Did you try tuning the sonar.sources parameter of the Automatic analysis to your angular src folder?

I did , it didn’t pick my code base at all. Not sure.

Thanks!