Multi-agent AI laboratory with ASP.NET Core 8.0 backend and Flutter frontend. Implements CQRS architecture, OpenAPI contract-first API design. BACKEND: Agent management, conversations, executions with PostgreSQL + Ollama FRONTEND: Cross-platform UI with strict typing and Result-based error handling Co-Authored-By: Jean-Philippe Brule <jp@svrnty.io>
3.6 KiB
3.6 KiB
Code Review Guide - Roslynator + SonarScanner
Overview
Multiple code review tools are installed for comprehensive analysis:
Roslynator (Recommended - No Server Required)
- 500+ C# analyzers
- Performance optimizations
- Code style checks
- Auto-fix capabilities
SonarScanner (Requires SonarQube Server)
- Code smells and bugs
- Security vulnerabilities
- Code duplications
- Technical debt calculation
Quick Start (Recommended)
Local Code Review with Roslynator
# Run comprehensive local review (no server needed)
./code-review-local.sh
Output:
- Console report with findings
- XML results:
code-review-results.xml - Summary:
CODE-REVIEW-SUMMARY.md
Auto-fix issues:
dotnet roslynator fix Codex.sln
dotnet format Codex.sln
Option 2: Full SonarQube Integration (Recommended)
Setup SonarQube Server (Docker)
# Add to docker-compose.yml
docker run -d --name sonarqube -p 9000:9000 sonarqube:lts-community
# Access SonarQube UI
open http://localhost:9000
# Login: admin/admin (change on first login)
Run Analysis with Server
./code-review.sh
View results at: http://localhost:9000/dashboard?id=codex-adk-backend
Manual Analysis
# Export PATH
export PATH="$PATH:/Users/jean-philippe/.dotnet/tools"
# Begin analysis
dotnet-sonarscanner begin \
/k:"codex-adk-backend" \
/n:"CODEX ADK Backend" \
/v:"1.0.0" \
/d:sonar.host.url="http://localhost:9000"
# Build
dotnet build
# End analysis
dotnet-sonarscanner end
Configuration
Location: .sonarqube/sonar-project.properties
Excluded from analysis:
obj/directoriesbin/directoriesMigrations/files- Test projects
Modify exclusions:
sonar.exclusions=**/obj/**,**/bin/**,**/Migrations/**,**/*.Tests/**
CI/CD Integration
GitHub Actions
- name: SonarScanner Analysis
run: |
dotnet tool install --global dotnet-sonarscanner
./code-review.sh
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Pre-commit Hook
# .git/hooks/pre-commit
#!/bin/bash
./code-review.sh || exit 1
SonarCloud (Alternative)
For cloud-based analysis without local server:
- Sign up: https://sonarcloud.io
- Create project token
- Update
code-review.sh:
dotnet-sonarscanner begin \
/k:"your-org_codex-adk-backend" \
/o:"your-org" \
/d:sonar.host.url="https://sonarcloud.io" \
/d:sonar.token="YOUR_TOKEN"
Analysis Reports
Quality Gate Metrics:
- Bugs: 0 target
- Vulnerabilities: 0 target
- Code Smells: Minimized
- Coverage: >80% (with tests)
- Duplication: <3%
Report Locations:
- Local:
.sonarqube/directory - Server: http://localhost:9000/dashboard
- Cloud: https://sonarcloud.io
Troubleshooting
PATH not found
# Add to ~/.zprofile
export PATH="$PATH:/Users/jean-philippe/.dotnet/tools"
# Reload
source ~/.zprofile
Connection refused
Ensure SonarQube server is running:
docker ps | grep sonarqube
Build errors during scan
dotnet clean
dotnet restore
./code-review.sh
Best Practices
- Run before commits: Catch issues early
- Review warnings: Address all code smells
- Security first: Fix vulnerabilities immediately
- Maintain quality gate: Keep passing standards
- Regular scans: Integrate into CI/CD pipeline