-
Notifications
You must be signed in to change notification settings - Fork 1
guides_code_quality
Comprehensive code quality and testing infrastructure.
- 📋 Übersicht
- ✨ Features
- 🚀 Quick Start
- 📖 Quality Checks
- 💡 Best Practices
- 🔧 Troubleshooting
- 📚 Siehe auch
- 📝 Changelog
ThemisDB uses a comprehensive code quality pipeline to ensure high standards across the codebase.
Stand: 22. Dezember 2025
Version: 1.3.0
Kategorie: 🛠️ Developer/Technical
- 🔍 Static Analysis - clang-tidy for C++17 best practices
- 🧹 Linting - cppcheck for additional validation
- 📊 Coverage - gcov/lcov code coverage measurement
- 🔐 Secret Scanning - Gitleaks prevents credential leaks
Linux/macOS:
# Run all checks
./scripts/check-quality.sh
# Skip specific checks
./scripts/check-quality.sh --skip-tidy --skip-tests
# Auto-fix issues
./scripts/check-quality.sh --fixWindows:
# Run all checks
.\scripts\check-quality.ps1
# Skip specific checks
.\scripts\check-quality.ps1 -SkipTidy -SkipTests
# Auto-fix issues
.\scripts\check-quality.ps1 -FixLinux (Ubuntu/Debian):
sudo apt-get update
sudo apt-get install -y \
cmake \
ninja-build \
clang-tidy \
clang-tools \
cppcheck \
lcov \
gcovr
# Install gitleaks
wget https://github.com/gitleaks/gitleaks/releases/download/v8.18.4/gitleaks_8.18.4_linux_x64.tar.gz
tar -xzf gitleaks_8.18.4_linux_x64.tar.gz
sudo mv gitleaks /usr/local/bin/macOS:
brew install cmake ninja llvm cppcheck lcov gitleaksWindows:
# Using Chocolatey
choco install cmake llvm cppcheck gitleaks
# Using Scoop
scoop install cmake llvm cppcheck gitleaksFile: .github/workflows/code-quality.yml
Triggers:
- Push to
mainordevelopbranches - Pull requests to
mainordevelop
Jobs:
-
clang-tidy: Static analysis with modern C++ checks
- Runs on Ubuntu latest
- Uses
.clang-tidyconfiguration - Generates
clang-tidy-report.txt - Uploads artifact for review
-
cppcheck: C++ linting
- Runs on Ubuntu latest
- Uses
.cppcheck-suppressionsfor known false positives - Generates XML and text reports
- Uploads artifacts
-
coverage: Code coverage analysis
- Builds with
--coverageflags - Runs full test suite
- Generates lcov reports and HTML output
- Comments on PRs with coverage summary
- Uploads coverage artifacts
- Builds with
-
gitleaks: Secret scanning
- Scans full repository history
- Uses
.gitleaks.tomlconfiguration - Fails build if secrets detected
- Uploads report for review
-
quality-summary: Aggregates all job results
- Fails if gitleaks finds secrets
- Reports overall status
File: .github/workflows/coverage-badge.yml
Triggers:
- Push to
mainbranch - Manual workflow dispatch
Purpose:
- Generates coverage percentage badge
- Deploys HTML coverage report to GitHub Pages
- Updates coverage badge in README
Setup Required:
- Create a GitHub Gist for badge storage
- Add
GIST_SECRETto repository secrets (Personal Access Token withgistscope) - Update
gistIDin workflow file - Enable GitHub Pages in repository settings
Configures clang-tidy checks for modern C++17:
Checks: >
bugprone-*,
clang-analyzer-*,
cppcoreguidelines-*,
modernize-*,
performance-*,
readability-*,
concurrency-*Disabled checks:
-
modernize-use-trailing-return-type: Unnecessary for our style -
readability-magic-numbers: Too noisy, use sparingly -
cppcoreguidelines-pro-bounds-pointer-arithmetic: RocksDB integration requires this
Naming conventions:
- Namespaces:
lower_case - Classes/Structs:
CamelCase - Functions:
camelCase - Variables:
lower_case - Private members:
lower_case_ - Constants:
UPPER_CASE
Suppresses known false positives:
# System headers
missingIncludeSystem
unmatchedSuppression
# Third-party code
*:vcpkg_installed/*
*:*/crow/*
*:*/rocksdb/*
# Test files (more flexible)
unusedFunction:tests/*
Configures secret detection rules:
Custom rules:
- ThemisDB API keys
- Database connection strings with credentials
- JWT secrets
- Encryption keys
- AWS credentials
- GitHub tokens
- Slack tokens
Allowlists:
- Test files:
tests/** - Documentation:
docs/** - Example configs:
*.example.*,*.template.*
When you open a PR, the code-quality workflow runs automatically:
- clang-tidy analyzes code for bugs and style issues
- cppcheck performs additional linting
- coverage measures test coverage and comments on PR
- gitleaks scans for secrets (blocks merge if found)
Configure branch protection rules to require:
-
clang-tidy(recommended) -
cppcheck(recommended) -
coverage(optional, for metrics) -
gitleaks(mandatory, blocks secrets)
Each workflow uploads artifacts:
- clang-tidy-report (30 days retention)
- cppcheck-xml-report (30 days)
- cppcheck-text-report (30 days)
- coverage-reports (30 days, includes HTML)
- gitleaks-report (30 days, JSON + summary)
Download from GitHub Actions UI: Actions → Workflow Run → Artifacts
Local:
# Generate coverage locally
./scripts/check-quality.sh
# Generate HTML report
mkdir -p coverage
lcov --capture --directory build --output-file coverage/coverage.info --rc lcov_branch_coverage=1
lcov --remove coverage/coverage.info '/usr/*' '*/vcpkg_installed/*' '*/tests/*' \
--output-file coverage/coverage-filtered.info --rc lcov_branch_coverage=1
genhtml coverage/coverage-filtered.info --output-directory coverage/html
# Open in browser
xdg-open coverage/html/index.html # Linux
open coverage/html/index.html # macOS
start coverage/html/index.html # WindowsGitHub Actions:
- Coverage report comments on PRs
- HTML report deployed to GitHub Pages:
https://<org>.github.io/<repo>/coverage/ - Badge in README (after setup)
- Overall: Target 80%+ line coverage
-
Critical paths: 90%+ coverage
- Storage engine
- Transaction logic
- Query engine
-
Nice-to-have: 70%+ coverage
- HTTP handlers
- Utility functions
-
Run local checks:
./scripts/check-quality.sh
-
Fix clang-tidy warnings:
./scripts/check-quality.sh --fix
-
Review cppcheck output:
- Suppress known false positives in
.cppcheck-suppressions - Use
// cppcheck-suppress <error_id>inline for one-off cases
- Suppress known false positives in
-
Check coverage:
- Add tests for new code
- Aim for >80% coverage on modified files
-
Scan for secrets:
- Review gitleaks output carefully
- Never commit real API keys or passwords
- Use
.env.examplefor templates
clang-tidy:
// Disable specific check for one line
// NOLINTNEXTLINE(check-name)
auto ptr = reinterpret_cast<void*>(addr);
// Disable for block
// NOLINTBEGIN(check-name)
// ... code ...
// NOLINTEND(check-name)cppcheck:
// Inline suppression
// cppcheck-suppress unusedFunction
void helperFunction() { }gitleaks:
Add to .gitleaks.toml allowlist:
[rules.allowlist]
paths = [
'''tests/fixtures/test_keys.json'''
]
regexes = [
'''(?i)test[-_]?api[-_]?key'''
]Solution:
# Run on changed files only
git diff --name-only main | grep -E '\.(cpp|h)$' | \
xargs clang-tidy -p buildSolution:
Add to .cppcheck-suppressions:
specificError:path/to/file.cpp:123
Solution:
Update .gitleaks.toml:
[allowlist]
paths = [
'''tests/test_data/.*'''
]Solution: Ensure all tests run before generating report:
cd build
ctest --output-on-failure
cd ..
lcov --capture --directory build ...Planned integrations:
- SonarQube: Comprehensive code quality dashboard
- Codecov: Advanced coverage tracking
- CodeClimate: Maintainability scoring
- Snyk: Dependency vulnerability scanning
ThemisDB v1.3.4 | GitHub | Documentation | Discussions | License
Last synced: January 02, 2026 | Commit: 6add659
Version: 1.3.0 | Stand: Dezember 2025
- Übersicht
- Home
- Dokumentations-Index
- Quick Reference
- Sachstandsbericht 2025
- Features
- Roadmap
- Ecosystem Overview
- Strategische Übersicht
- Geo/Relational Storage
- RocksDB Storage
- MVCC Design
- Transaktionen
- Time-Series
- Memory Tuning
- Chain of Thought Storage
- Query Engine & AQL
- AQL Syntax
- Explain & Profile
- Rekursive Pfadabfragen
- Temporale Graphen
- Zeitbereichs-Abfragen
- Semantischer Cache
- Hybrid Queries (Phase 1.5)
- AQL Hybrid Queries
- Hybrid Queries README
- Hybrid Query Benchmarks
- Subquery Quick Reference
- Subquery Implementation
- Content Pipeline
- Architektur-Details
- Ingestion
- JSON Ingestion Spec
- Enterprise Ingestion Interface
- Geo-Processor Design
- Image-Processor Design
- Hybrid Search Design
- Fulltext API
- Hybrid Fusion API
- Stemming
- Performance Tuning
- Migration Guide
- Future Work
- Pagination Benchmarks
- Enterprise README
- Scalability Features
- HTTP Client Pool
- Build Guide
- Implementation Status
- Final Report
- Integration Analysis
- Enterprise Strategy
- Verschlüsselungsstrategie
- Verschlüsselungsdeployment
- Spaltenverschlüsselung
- Encryption Next Steps
- Multi-Party Encryption
- Key Rotation Strategy
- Security Encryption Gap Analysis
- Audit Logging
- Audit & Retention
- Compliance Audit
- Compliance
- Extended Compliance Features
- Governance-Strategie
- Compliance-Integration
- Governance Usage
- Security/Compliance Review
- Threat Model
- Security Hardening Guide
- Security Audit Checklist
- Security Audit Report
- Security Implementation
- Development README
- Code Quality Pipeline
- Developers Guide
- Cost Models
- Todo Liste
- Tool Todo
- Core Feature Todo
- Priorities
- Implementation Status
- Roadmap
- Future Work
- Next Steps Analysis
- AQL LET Implementation
- Development Audit
- Sprint Summary (2025-11-17)
- WAL Archiving
- Search Gap Analysis
- Source Documentation Plan
- Changefeed README
- Changefeed CMake Patch
- Changefeed OpenAPI
- Changefeed OpenAPI Auth
- Changefeed SSE Examples
- Changefeed Test Harness
- Changefeed Tests
- Dokumentations-Inventar
- Documentation Summary
- Documentation TODO
- Documentation Gap Analysis
- Documentation Consolidation
- Documentation Final Status
- Documentation Phase 3
- Documentation Cleanup Validation
- API
- Authentication
- Cache
- CDC
- Content
- Geo
- Governance
- Index
- LLM
- Query
- Security
- Server
- Storage
- Time Series
- Transaction
- Utils
Vollständige Dokumentation: https://makr-code.github.io/ThemisDB/