SonarCloud Configuration
The SonarCloud analysis was configured to focus on relevant issues:
# sonar-project.properties
sonar.qualitygate.wait=true
sonar.coverage.exclusions=**/*Test*,**/migrations/**
sonar.cpd.exclusions=**/generated/**
Quality profiles were customised to balance strictness with developer productivity - overly pedantic rules that generate noise reduce trust in the tooling.
SQL Injection Remediation
The legacy code included raw SQL construction:
// Before (vulnerable)
var query = $"SELECT * FROM users WHERE email = '{email}'";
// After (safe)
var query = "SELECT * FROM users WHERE email = @email";
cmd.Parameters.AddWithValue("@email", email);
Every database access point was audited and converted to parameterised queries, with SonarCloud rules configured to flag any future raw SQL construction.
Test Strategy
Coverage alone does not indicate test quality. We emphasised:
- Behaviour testing - tests verify business requirements, not implementation details
- Edge cases - especially around payment and booking logic
- Integration tests - for service boundaries and external integrations
- Fast feedback - unit tests run on every commit, integration tests on PR
Continuous Improvement
The quality programme was designed to be sustainable:
- Ratchet approach - coverage targets only increase, never decrease
- Boy Scout rule - leave code cleaner than you found it
- Technical debt sprints - periodic focused cleanup efforts
- Metrics dashboards - visibility into trends, not just current state
Dependency Management
Automated dependency scanning was configured to:
- Alert on new vulnerabilities in dependencies
- Block deployment if critical vulnerabilities present
- Track dependency age and update recommendations
- Generate automated PRs for security patches (via Dependabot)