SonarQube for Visual Studio plugin version: 8.9.0.11507
Programming language you’re coding in: C# (.net framework 4.8)
Is connected mode used: yes
SonarQube Cloud, SonarQube Server, or SonarQube Community Build? (if one of the latter two, which version?): SonarQube Cloud
And a thorough description of the problem / question:
I have configured SonarCloud to only analyze files in certain folder via Source File Inclusions in the portal. I use two rows:
**/Modules/**/*.cs
**/Infrastructure/**/*.cs
This works in the portal, I only see issues from those subfolders. But it doesn’t work in the extension, it shows issues from any file I view. Are source file inclusions configured in the portal supposed to be respected by the extension? Is there something I can do to fix it? Happy to give more information.
The logs look good actually. It logs the settings, and it logs the correct decision. But even though it logs “should analyze: False” for a file I still get squiggly lines and editor warnings.
Here are logs for two files, the first one (PlantMaintenanceService.cs) shouldn’t be analyzed but is. The second one should be analyzed and is.
[ThreadId 12] [DEBUG] [SLCORE] Computing file exclusion for uri 'file:///C:/Application/Company/Application/src/Application%20solution/Company%20Application%20Server/ServiceBusinessLogic/PlantMaintenance/PlantMaintenanceService.cs'
[ThreadId 12] [DEBUG] [SLCORE] Server included sources:
[ThreadId 12] [DEBUG] [SLCORE] **/Modules/**/*.cs
[ThreadId 12] [DEBUG] [SLCORE] **/Infrastructure/**/*.cs
[ThreadId 12] [DEBUG] [SLCORE] Server excluded sources:
[ThreadId 12] [DEBUG] [SLCORE] **/build-wrapper-dump.json
[ThreadId 12] [DEBUG] [SLCORE] File exclusion for uri 'file:///C:/Application/Company/Application/src/Application%20solution/Company%20Application%20Server/ServiceBusinessLogic/PlantMaintenance/PlantMaintenanceService.cs' is true
[ThreadId 61] [DEBUG] [ExclusionSettingsStorage] File content: {
"sonar.exclusions": [],
"sonar.global.exclusions": [
"**/build-wrapper-dump.json"
],
"sonar.inclusions": [
"**/Modules/**/*.cs",
"**/Infrastructure/**/*.cs"
]
}
[ThreadId 61] [DEBUG] [GlobPatternMatcher]
Pattern: **/Modules/**/*.cs
Regex: ^(?:.*\/|)Modules\/(?:.*\/|)[^\/]*?\.cs$
Input: C:/Application/Company/Application/src/Application solution/Company Application Server/ServiceBusinessLogic/PlantMaintenance/PlantMaintenanceService.cs
Is match: False
[ThreadId 61] [DEBUG] [GlobPatternMatcher]
Pattern: **/Infrastructure/**/*.cs
Regex: ^(?:.*\/|)Infrastructure\/(?:.*\/|)[^\/]*?\.cs$
Input: C:/Application/Company/Application/src/Application solution/Company Application Server/ServiceBusinessLogic/PlantMaintenance/PlantMaintenanceService.cs
Is match: False
[ThreadId 61] [DEBUG] [AnalyzableFileIndicator]
Server Exclusions:
Inclusions: **/Modules/**/*.cs,**/Infrastructure/**/*.cs
Exclusions:
Global Exclusions: **/build-wrapper-dump.json
file: 'C:/Application/Company/Application/src/Application solution/Company Application Server/ServiceBusinessLogic/PlantMaintenance/PlantMaintenanceService.cs'
should analyze: False
[ThreadId 61] [DEBUG] [AnalyzerController] No analyzer supported analysis of C:\Application\Company\Application\src\Application solution\Company Application Server\ServiceBusinessLogic\PlantMaintenance\PlantMaintenanceService.cs
[ThreadId 63] [DEBUG] Looking up implementation of 'IGetNotificationsRequest' on thread '63'
[ThreadId 63] [DEBUG] Created request of type 'SonarQube.Client.Api.V6_60.GetNotificationsRequest'.
[ThreadId 63] [DEBUG] Sending Http request:
[ThreadId 63] [DEBUG] Method: GET, RequestUri: 'api/developers/search_events?projects=Application&from=2025-01-15T16%3A18%3A06%2B0200', Version: 1.1, Content: <null>, Headers:
{
}
[ThreadId 44] [DEBUG] Response with HTTP status code 'OK' received.
[ThreadId 19] [DEBUG] {"events":[]}
[ThreadId 34] [DEBUG] Looking up implementation of 'IGetNotificationsRequest' on thread '34'
[ThreadId 34] [DEBUG] Created request of type 'SonarQube.Client.Api.V6_60.GetNotificationsRequest'.
[ThreadId 34] [DEBUG] Sending Http request:
[ThreadId 34] [DEBUG] Method: GET, RequestUri: 'api/developers/search_events?projects=Application&from=2025-01-15T16%3A18%3A06%2B0200', Version: 1.1, Content: <null>, Headers:
{
}
[ThreadId 57] [DEBUG] [SLCORE] Language of file "file:///C:/Application/Company/Application/src/Application%20solution/Infrastructure/Infrastructure.Logging.Client/DialogTracker.cs" is detected to be "CS"
[ThreadId 57] [DEBUG] [SLCORE] Processing file event C:/Application/Company/Application/src/Application solution/Infrastructure/Infrastructure.Logging.Client/DialogTracker.cs with event MODIFIED
[ThreadId 87] [DEBUG] [SLCORE] Computing file exclusion for uri 'file:///C:/Application/Company/Application/src/Application%20solution/Infrastructure/Infrastructure.Logging.Client/DialogTracker.cs'
[ThreadId 10] [DEBUG] [SLCORE] Server included sources:
[ThreadId 10] [DEBUG] [SLCORE] **/Modules/**/*.cs
[ThreadId 10] [DEBUG] [SLCORE] **/Infrastructure/**/*.cs
[ThreadId 10] [DEBUG] [SLCORE] Server excluded sources:
[ThreadId 10] [DEBUG] [SLCORE] **/build-wrapper-dump.json
[ThreadId 10] [DEBUG] [SLCORE] File exclusion for uri 'file:///C:/Application/Company/Application/src/Application%20solution/Infrastructure/Infrastructure.Logging.Client/DialogTracker.cs' is false
[ThreadId 5] [DEBUG] [ExclusionSettingsStorage] File content: {
"sonar.exclusions": [],
"sonar.global.exclusions": [
"**/build-wrapper-dump.json"
],
"sonar.inclusions": [
"**/Modules/**/*.cs",
"**/Infrastructure/**/*.cs"
]
}
[ThreadId 5] [DEBUG] [GlobPatternMatcher]
Pattern: **/Modules/**/*.cs
Regex: ^(?:.*\/|)Modules\/(?:.*\/|)[^\/]*?\.cs$
Input: C:/Application/Company/Application/src/Application solution/Infrastructure/Infrastructure.Logging.Client/DialogTracker.cs
Is match: False
[ThreadId 5] [DEBUG] [GlobPatternMatcher]
Pattern: **/Infrastructure/**/*.cs
Regex: ^(?:.*\/|)Infrastructure\/(?:.*\/|)[^\/]*?\.cs$
Input: C:/Application/Company/Application/src/Application solution/Infrastructure/Infrastructure.Logging.Client/DialogTracker.cs
Is match: True
[ThreadId 5] [DEBUG] [GlobPatternMatcher]
Pattern: **/build-wrapper-dump.json
Regex: ^(?:.*\/|)build-wrapper-dump\.json$
Input: C:/Application/Company/Application/src/Application solution/Infrastructure/Infrastructure.Logging.Client/DialogTracker.cs
Is match: False
[ThreadId 5] [DEBUG] [AnalyzableFileIndicator]
Server Exclusions:
Inclusions: **/Modules/**/*.cs,**/Infrastructure/**/*.cs
Exclusions:
Global Exclusions: **/build-wrapper-dump.json
file: 'C:/Application/Company/Application/src/Application solution/Infrastructure/Infrastructure.Logging.Client/DialogTracker.cs'
should analyze: True
[ThreadId 5] [SLCoreAnalyzer] Analyzing C:\Application\Company\Application\src\Application solution\Infrastructure\Infrastructure.Logging.Client\DialogTracker.cs with id
Is the problem still reproducible after a restart of the VS instance?
Could you, please, provide us the way your settings for sonar.inclusions look like
that inside the file %AppData%\Roaming\SonarLint for Visual Studio\Bindings\[YourSolutionName]\CSharp\SonarLint.xml?