Skip to content

Commit b32c56d

Browse files
nanotaboadaclaude
andcommitted
ci(sonar): add sonar-project.properties
Configures SonarCloud analysis for the project: - Scopes sources and tests to their respective directories - Excludes build artifacts, generated files, and EF Core migrations from analysis and coverage metrics - Excludes the test project from duplicate code (CPD) detection — Fakes, Mocks, and Stubs are intentionally repetitive by design Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2f3bc60 commit b32c56d

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

sonar-project.properties

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# =============================================================================
2+
# SonarCloud configuration
3+
# https://docs.sonarsource.com/sonarcloud/advanced-setup/analysis-parameters/
4+
#
5+
# Project key and organization can be verified in SonarCloud under:
6+
# Administration → General Settings
7+
# =============================================================================
8+
9+
sonar.projectKey=nanotaboada_Dotnet.Samples.AspNetCore.WebApi
10+
sonar.organization=nanotaboada
11+
12+
# Source encoding
13+
sonar.sourceEncoding=UTF-8
14+
15+
# =============================================================================
16+
# Sources and tests
17+
# =============================================================================
18+
19+
sonar.sources=src/
20+
sonar.tests=test/
21+
sonar.test.inclusions=test/**/*.cs
22+
23+
# =============================================================================
24+
# Global exclusions
25+
# Keeps analysis focused on hand-written production code.
26+
# =============================================================================
27+
28+
sonar.exclusions=\
29+
**/obj/**,\
30+
**/bin/**,\
31+
**/Migrations/**
32+
33+
# =============================================================================
34+
# Coverage exclusions
35+
# Test files and generated/infrastructure code should not count against
36+
# production code coverage metrics.
37+
# =============================================================================
38+
39+
sonar.coverage.exclusions=\
40+
test/**/*.cs,\
41+
**/Migrations/**,\
42+
**/Data/PlayerDbContext.cs
43+
44+
# =============================================================================
45+
# Duplicate code (CPD) exclusions
46+
# Test utilities (Fakes, Mocks, Stubs) are intentionally repetitive by design:
47+
# each operation gets its own factory method and the similarity between
48+
# arrange/act/assert blocks across tests is expected and harmless.
49+
# =============================================================================
50+
51+
sonar.cpd.exclusions=test/**/*.cs

0 commit comments

Comments
 (0)