-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsonar-project.properties
More file actions
97 lines (75 loc) · 3.2 KB
/
sonar-project.properties
File metadata and controls
97 lines (75 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Must be unique in a given SonarCloud instance
sonar.projectKey=meaningfy-ws_mapping-suite-sdk
sonar.organization=meaningfy-ws
# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=Mapping Suite SDK
sonar.projectVersion=0.1.0
# Path is relative to the sonar-project.properties file
sonar.sources=mapping_suite_sdk
sonar.tests=tests/unit
# Source encoding
sonar.sourceEncoding=UTF-8
# Python version
sonar.python.version=3.11
# Coverage report path
sonar.python.coverage.reportPaths=coverage.xml
# Test report path
sonar.python.xunit.reportPath=test-results.xml
# Exclude test files from coverage analysis
sonar.coverage.exclusions=tests/**/*,setup.py
# Exclude test files from duplication detection
sonar.cpd.exclusions=tests/**/*
# Additional exclusions (if needed)
sonar.exclusions=docs/**/*,*.md
# Branch analysis - enable for main, develop, feature/*, release/*
sonar.branch.autoconfig.disabled=false
#-----------------------------------------------------------------------------
# SOLID Principles Quality Gates Configuration
#-----------------------------------------------------------------------------
# Single Responsibility Principle (SRP)
# Limit cognitive complexity per function (max 15 is recommended)
sonar.python.S3776.threshold=15
# Limit cyclomatic complexity per function (max 10 is good practice)
sonar.python.S1541.threshold=10
# Max lines per function (to enforce small, focused functions)
sonar.python.S104.max=50
# Max lines per class (to enforce focused classes)
sonar.python.S1188.max=500
# Open/Closed Principle (OCP)
# Discourage too many conditional statements (suggests need for polymorphism)
sonar.python.S1066.max=3
# Liskov Substitution Principle (LSP)
# Limit inheritance depth to avoid deep hierarchies
sonar.python.S110.max=4
# Dependency Inversion Principle (DIP)
# Enforce low coupling - limit dependencies between modules
# This is tracked through the "Coupling" metric in SonarCloud
# Don't Repeat Yourself (DRY) - Related to SOLID
# Minimum duplicate lines to trigger an issue (lower = stricter)
sonar.cpd.python.minimumLines=3
# Minimum duplicate tokens
sonar.cpd.python.minimumTokens=50
# Code Quality Thresholds
# These align with SOLID by enforcing maintainability
sonar.qualitygate.wait=true
sonar.qualitygate.timeout=300
# Quality Gate Configuration (must be set in SonarCloud UI)
# Create custom quality gate "SOLID Principles Gate" with these conditions on New Code:
# - Critical Issues: is greater than 0 → FAIL
# - Blocker Issues: is greater than 0 → FAIL
# - Security Hotspots Reviewed: is less than 100% → FAIL
# - Coverage: is less than 80% → FAIL (optional)
# - Duplicated Lines: is greater than 3% → FAIL (optional)
# Coverage Requirements (helps ensure code is testable - SOLID benefit)
sonar.coverage.exclusions=tests/**/*,setup.py,**/__init__.py,**/cli/**/*
# Maintainability Rating Threshold
# A = tech debt ratio <= 5%
# B = tech debt ratio 6-10%
# C = tech debt ratio 11-20%
# Enforce at least B rating
sonar.maintainability.rating.threshold=B
# Code Smells - identify potential SOLID violations
# New code should have 0 code smells (can be adjusted)
sonar.newCode.codeSmells=0
# Complexity thresholds for overall project
sonar.complexity.threshold=10