Is there a way to analyze entire code base not just difs?

I understand the fixing the water leak method of looking only at new code, but using your analogy I need to show how big the puddle is before I get the buy in to start fixing the leak. A full analysis would also give the ability start mopping up the puddle by making tech debt items based on issue in old code, as well as periodically show the change in overall code quality.

Is there a way to force a whole code base analysis?

Analyzing an entire project and showing all the issues in the entire project on SonarCloud is the default behavior, and the simplest way to run analysis. It should give you exactly what you asked for in this post.

I added the extraProperty sonar.scm.forceReloadAll = true, which looks like it forces an analysis of all files. However my analysis is still showing no issues.

WARN: Forced reloading of SCM data for all files.
INFO: SCM provider for this project is: git
INFO: 827 files to be analyzed
INFO: 88/827 files analyzed
WARN: Missing blame information for the following files:
WARN: * Project/Folder/file.aspx.vb
WARN: * Project/PNC/Folder/file.aspx
WARN: * Project/Scripts/WebForms/Focus.js

WARN: This may lead to missing/broken features in SonarQube

Thank you for the information Janos,

How would I get the default behavior from SonarCloud in my Azure build pipeline?

My prepare task looks like:

- task: SonarCloudPrepare@1
  displayName: 'Prepare SonarCloud analysis'
  inputs:
    SonarCloud: 'connection'
    organization: '$(organization)'
    projectKey: '$(projectKey)'
    projectName: '$(projectName)'
    projectVersion: '$(Build.BuildNumber)'
    extraProperties: |
      sonar.scm.forceReloadAll = true

Since the only difference in my project is the pipeline file I am seeing 0’s for bugs, code smells, and duplications. Is there a configuration or setting I am missing? (My project is a VB dotnet project targeting version 4.6.1)

When following any tutorials I have been able to find, my sonarCloud analysis is shows the following with no issues.

100% • 75% • 50%

This code base is far from perfect in fact MSBuild’s Roslyn linting tool shows 8808 Warnings. I would expect that a full analysis by SonarCloud would find at least a subset of those.

This is a feature branch I am analysing. Is the full linting only done on pull requests, or master? I would appreciate any guidance.

A-ha! Your screenshot shows the analysis of a short-living branch, which works similarly to a pull request analysis. In this case you see only the issues in the diff, compared to the target branch (the main branch by default).

To analyze your branch as a long-living branch, in your project’s page on SonarCloud, go to ** Administration / Branches & Pull Requests** and edit the pattern shown in the top-right corner. (The default value is (branch|release)-.*.)

Once your branch name matches this pattern, it will be analyzed as a long-living branch.

1 Like

Thank you Janos, I did not realize there was even the concept of short and long lived branches. I edited the pattern and am now getting the information I needed.