SonarCloud - Analysis disappearing with change to modules / project structure

sonarcloud
vsts
(Peter Connor) #1

Since the new project structure / upgrade has come to SonarCloud, analysis on a lot of our files has disappeared. The two screenshots below demonstrate the state of the project pre and post the file structure change that was released.

We used to have exclusions applied to the some of the files (hence why the content folder has less lines of code), but after removing all ‘Coverage Exclusions’ and all ‘Source File Exclusions’, these files are still not being analysed.

We have not set any properties in the Azure Devops pipeline, They are just the standard ‘Prepare’, ‘Run’ and ‘Publish’ tasks.

The run analysis file has no errors, but it doesn’t seem to be finding much to scan:

INFO: ------------- Run sensors on module FTA.PCN.Web
INFO: 1/1 source files have been analyzed
INFO: Sensor SonarCSS Metrics [cssfamily]
INFO: Sensor SonarCSS Metrics [cssfamily] (done) | time=641ms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=81028ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor JavaXmlSensor [java]
INFO: 3 source files to be analyzed
INFO: Sensor JavaXmlSensor [java] (done) | time=141ms
INFO: Sensor XML Sensor [xml]
INFO: Sensor XML Sensor [xml] (done) | time=0ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 3/3 source files have been analyzed
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms

Is JavaXmlSensor for Javascript? Our projects are c# and contain no Java.

I’m not sure what other helpful information I can post.

Many thanks,
Pete

EDIT: Looking at the Sonar Context for the latest analysis, it seems there are no source files being passed in:

  • sonar.projectKey=PCNAdmin:PCNAdmin:787814B2-448A-46B5-AFEB-C54F2A3019BD
  • sonar.projectName=FTA.PCN.Web
  • sonar.sourceEncoding=utf-8
  • sonar.sources=

EDIT2: It seems the scanner is ignoring our JavaScript files, when you look at the project overview, there are no LOC for JS…

1 Like
1.6.0 SonarCloud VSTS plugin update causes files not to be processed
(Amaury Levé) #4

Hi @pconnor,

Could you re-run the build using the debug mode and provide the full log of the end step task?

FYI, it should contain some debug logs with the content of the file sonar-project.properties which list all files that are going to be analyzed. So you should be able to already see if some files are missing from the listing.

Cheers,
Amaury

(Peter Connor) #5

Hi @Ammo,

Sorry I forgot to reply and close this thread. The project structure changes were a bit of a red herring. Our build box had the .net framework upgraded and for some reason some of our projects were now being classed as test projects, with all javascript files being put in the sonar.tests property. Editing the .csproj and specifically setting testproject to false fixed this issue.

I’m not sure why it came about, but did find a resolution in the end,

(Amaury Levé) #6

Glad to hear everything is now fixed :smiley: